Hello guys,


I have implemented the jquery validation in one of my projects.

I have a <div> which has all the billing details
& another <div> below it which has the shipping details.
There is a checkbox in between these <div>'s which says "Same as Billing Address". It is used to populate all the shipping fields from the billing fields.

Well, on this particular form there are some fields which are mandatory & which I have validated by jquery validation.

I have used the $("#form_id").validate().form(); statement to check validation on the click event of the checkbox.
The actual problem is that after page loads, I directly click on the checkbox & submit the page,
the page gets submitted & validation does not execute.
If I click the submit button with the checkbox unchecked then the validation runs properly.

Why is my form not being validated if I checked the checkbox?
Please guys, help me out.


Thanks in advance.

Bhavik.

If you haven't resolved this problem on your own yet: Sounds like you have not properly attached the validation to the click event or are replacing it with another click event (maybe your field copy function?). There are really too many possible issues to speculate further... Seeing the code would help.

If there is too much code for the whole program copy here the two divs and the validation so that we can look at the actual code. Also, why the second form() in the validation?

$("#form_id").validate();

should do the trick. Check http://plugins.jquery.com/project/jqueryvalidate.
Otherwise I would also suggest that you've probably improperly attached the validation to the events.

Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.