Sep 19, 2012

f Comment

[SOLVED] jQuery Form Validation is NOT Working!

Amazon If you use jQuery's form validation plugin at http://docs.jquery.com/Plugins/Validation you may run into problems. It's simply not working! Why? I am doing everything I am asked to do but it is just not working!

Background
One problem is http://docs.jquery.com/Plugins/Validation does NOT tell you EXACTLY what you need to do in order to make everything work. It just asks you to include this line of code

$("#commentForm").validate();
where appropriate and add a bit of metadata on each element to specify the validation rules. But is that really it?

Turns out that it really is it. I am just venting my complaints that it should've been more specific.

Possible Solution
Make sure your HTML form block is correctly nested! Better yet make sure you use XHTML for readability and validation purposes. For example if you have nesting issues such as:

<table><form>
...</form>
</table>

Then the jQuery form validation will NOT work. I ran into this issue when I installed 'pbbooking' plugin, an extension to manage appointments and scheduling, to my Joomla CMS website. Thankfully I fixed this issue as soon as I encountered it. Thought I'd share it with those who didn't see this fix.

Bad nesting will make jQuery fail to access and manipulate some elements from the DOM!
If you have any questions let me know and I will do my best to help you!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael