Author Topic: jquery validate not working in IE - solution  (Read 15668 times)

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
jquery validate not working in IE - solution
« on: October 07, 2010, 09:31:13 AM »
I discovered today that one of my forms that uses jquery validation wasn't validating in Internet Explorer!

The validation worked fine when the form was used to insert a new record, but the submit button went straight to the next procedure when the same form was used to edit a record. It worked fine in Firefox.

After a couple of hours fiddling with the validation code, I narrowed the problem down to a SELECT control. I had formatted the select option as...

<select name="suburb" title="Your business must be located in one of these suburbs">
<option value = ''/>***NONE***
<option />AKUNA BAY
<option />ALLAMBIE
<option />ALLAMBIE HEIGHTS

IOW I hadn't specified a "VALUE" for each option - this completely broke the jquery validation for the whole form!

Changing the options to...

<select name="suburb" title="Your business must be located in one of these suburbs">
<option value = ''/>***NONE***
<option value='AKUNA BAY' />AKUNA BAY
<option value='ALLAMBIE' />ALLAMBIE
<option value='ALLAMBIE HEIGHTS' />ALLAMBIE HEIGHTS

...fixed it.

Thought I'd pass it on to others for possible future reference.

Offline BerndJM

  • Posts: 1764
  • Gender: Male
Re: jquery validate not working in IE - solution
« Reply #1 on: October 07, 2010, 11:46:29 AM »
Hi,

no idea where you've learned that coding ;-)
but I'll bet, if you use a correct html syntax it will even work in IE without the need of setting a value ...

Code: [Select]
<select name="top5" size="3">
      <option>Heino</option>
      <option>Michael Jackson</option>
      <option>Tom Waits</option>
      <option>Nina Hagen</option>
      <option>Marianne Rosenberg</option>
    </select>


Regards Bernd
In theory, there is no difference between theory and practice. But, in practice, there is.

Offline PurpleEdge

  • Posts: 231
  • Gender: Male
    • the northern beaches
Re: jquery validate not working in IE - solution
« Reply #2 on: October 07, 2010, 02:30:37 PM »
Hi Bernd,

Nice thought, but unfortunately wrong  :wink:

It is the missing "value" that causes the error.

In HTML the option tag has no closing tag, but I guess it is time I started using xhtml  :-)

Regards,
Geoff B

 

postern-length