Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1253447

    Dear support team,

    In the course of the revision of the website of the Kunstmuseum Ahlen with regard to barrier-free options, we came across the contact form, which is located on the following page:

    Unfortunately, the input fields as ‘labels’ only have general identifiers such as “avia_1_1”, “avia_2_1”, …
    In order to meet the BITV’s catalog of measures (accessibility), input fields for user data must be marked in such a way that they convey their purpose, i.e. In the input field for the name, for example, the term “Name” … should not be “avia_1_1”.

    Is it possible to rework here? How could I add terms here? Do you have any advice on how we could solve the problem?

    Thank you for your preparation.
    regards

    #1255445

    Hey Diana,
    Sorry for the very late reply, and thanks for the link to your contact form. As I understand your request, for each form element there is a label with the attribute “for”, and an input with the attribute “name”.
    Currently, they are displaying the element ID as the attributes, such as “avia_1_1”, so to correct, this script gets the label text and replaces two attributes with it for each element in the form.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_form_attribute_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
      $('form p.form_element').each(function() {
      	var labeltext = $(this).find("label").text().slice(0, -2);
      	$(this).find("label").attr("for", labeltext);
        $(this).find("input").attr("name", labeltext);
        $(this).find("textarea").attr("name", labeltext);
      });
     });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_form_attribute_script');

    Then clear your browser cache and check.

    Best regards,
    Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.