WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 » [Resolved] [Plugin: Contact Form 7] cannot validate required custom fields

[Resolved] [Plugin: Contact Form 7] cannot validate required custom fields

  • I have created a barebone contact form through the admin panel.
    But there are cases that I create and add to the form my own custom text fields (through jQuery) based on whether the user is logged in in my website or not.

    The custom fields are generated correctly and their values posted fine when I click on the submit button. I have also added the class “wpcf7-validates-as-required” which is supposed to enforce them to be validated with some kind of value before the message is sent. The other fields which I generated through the admin panel do not have a problem with that and are correctly validated but my custom fields are posted even with null values…

    Any idea?

    P.S.
    Contact Form 7, version 3.2.1

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The validation is done for all fields with the following plugin but I prefer the built in validation function visually, so my problem still exists. 🙂
    http://wordpress.org/extend/plugins/jquery-validation-for-contact-form-7/

    Well, I couldn’t get why the validation script couldn’t catch my custom field so I resolved it the “opposite” thinking way. That is, I created the filed normally through admin panel and from my source code I used jQuery in order to hide it – instead of creating as I was trying to do.

    That way it finally worked!

    Although there was no response, thanks everyone who got in the trouble to bother with my problem. 🙂

    Just forgot to mark it as resolved. 🙂

    @george Vrettos I’m trying to get the validation to ignore required hidden fields which only become visible depending on what the visitor selects from the radio button options. I can’t get it to ignore them and then submit. I’ve used jquery to hide the fields but I’m pretty sure my problem is in the php. Did you have that problem? Do you have any suggestions?

    My test form is here/

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Contact Form 7] cannot validate required custom fields’ is closed to new replies.
Skip to toolbar