jquery form validation and IE6

Added on: Friday 17th April 2009

The validation plugin for jquery is a simple way to add sophisticated validation to any forms on your website. However, I recently had a problem with IE6.

The validation on the website I was working on was fine in Firefox and Opera and indeed Internet Explorer 8 but in IE6 the Submit button went straight to the next page without checking the form.

I noticed there was also a javascript error just before the page submitted.

A quick search on Google took me straight to the jQuery Validation website where I quickly found that this was a problem with the character encoding of the page.

It seems that if the character encoding is set to UTF-8 then there is a regular expression in the javascript that throws IE6. If the character encoding is ISO-8859-1 then all is fine.

The suggestion to resolve this was to track down the expression and removing the offending characters. However, as I was using the packed version of the file, I couldn't use this so I installed the unpacked version instead.

Obviously in the unpacked version the code is different as the validation worked fine in all browsers that I tested.

To summarise then - if you are using jQuery validation and your character encoding on the page is utf-8, use the unpacked version of the script.

I thought I'd post this as it saved me hours of messing around. And thanks to those before me who have found the solution to the problem.

comments powered by Disqus