WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Need validation help (3 posts)

  1. fcvolunteer
    Member
    Posted 1 year ago #

    I'm having a lot of trouble getting my form to validate correctly. I'm using the Contact Form 7 Jquery plugin as well but even when I deactivate it I'm still having issues.

    I've created a javascript file to enable show/hide functionality and that is working fine. The problem I'm having is that when I try to make one of the hidden fields required (which I really need to do) and I specify that it should only be required if visible, I'm running into validation errors and the form won't submit. Here's the link to my test form. If you click the first radio button and try submitting it returns an error because there's a field which appears when the second radio button is selected. I've checked the javascript in jsfiddle.net and it works fine and I was told (I'm not really a coder as you can tell :-( ) that the problem is in the server side php code somewhere in the Contact Form 7 plugin files. I was told that I need to specify something about validating only fields whose value > 0 and I'm not sure where or how exactly to do that since there are so many php files. Has anyone accomplished this? Can someone point me in the right direction or explain it more clearly to me? css, html, and design are more my thing and this coding thing is making me feel super dumb :-/

    thanks!

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

  2. fcvolunteer
    Member
    Posted 1 year ago #

    oops I updated the jquery version last night and forgot to update the header.php file so the show/hide wasn't working and the error couldn't be reproduced. It is back to having the validation error. Thanks to whoever tried to help me till now.

    I still need help.

  3. fcvolunteer
    Member
    Posted 1 year ago #

    I've looked around some more and added this

    $('.hide input').val('n/a');

    to my javascript. The weird thing, is that it actually fills in all the hidden fields with "n/a" even if only the first radio button is selected, so no fields are empty but unless the 2nd radio button is selected (that's the one that has the additional fields AND one is a required field) I get the yellow error "Validation errors occurred. Please confirm the fields and submit it again." and it doesn't submit.

    Any ideas of what I can change in the javascript or php to get this to work? link to my test form

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic