Support » Plugin: Contact Form 7 » Form validation for some fields does not work

  • Resolved torsten.dreier

    (@torstendreier)


    Hello,
    I am using a contact form that I customized with a lookup for Country and State fields. I included validation for the fields being required (or so I thought) but the user can submit the form without the fields being filled in.

    The form code

    [response]
    <p>Your Name (required)<br />[text* your-name] </p>
    <p>Your Email (required)<br />[email* your-email] </p>
    <p>Your Country (required)<br /><select class="wpcf7-form-control  wpcf7-select wpcf7-validates-as-required wpcf7-validates-as-text"  id="country" name="country" onchange="print_state('state',this.selectedIndex);" id="country" name = "country"></select> </p><p>Your State (required)<br />
    <select class="wpcf7-form-control  wpcf7-select wpcf7-validates-as-required wpcf7-validates-as-text"  name ="state" id = "state"></select>
    <script language="javascript">print_country("country");</script></p>
    <p>Subject<br />[select* topic "General" "Sales" "Training" "Support" "Licensing" "Customer Care"] </p>
    <p>Your Message<br />[textarea your-message] </p>
    <p>[submit "Send"]</p>

    Any help is appreciated

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter torsten.dreier

    (@torstendreier)

    Takayuki,
    when I add the “*” to the select clause to mark it as required, it breaks the clause.

    [response]
    <p>Your Name (required)<br />[text* your-name] </p>
    <p>Your Email (required)<br />[email* your-email] </p>
    <p>Your Country (required)<br /><select* class="wpcf7-form-control  wpcf7-select wpcf7-validates-as-required wpcf7-validates-as-text"  id="country" name="country" onchange="print_state('state',this.selectedIndex);" id="country" name = "country"></select> </p><p>Your State (required)<br />
    <select* class="wpcf7-form-control  wpcf7-select wpcf7-validates-as-required wpcf7-validates-as-text"  name ="state" id = "state"></select>
    <script language="javascript">print_country("country");</script></p>
    <p>Subject<br />[select* topic "General" "Sales" "Training" "Support" "Licensing" "Customer Care"] </p>
    <p>Your Message<br />[textarea your-message] </p>
    <p>[submit "Send"]</p>

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Form validation for some fields does not work’ is closed to new replies.