WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => jQuery => Topic started by: PurpleEdge on October 07, 2010, 09:31:13 AM

Title: jquery validate not working in IE - solution
Post by: PurpleEdge 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.
Title: Re: jquery validate not working in IE - solution
Post by: BerndJM 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
Title: Re: jquery validate not working in IE - solution
Post by: PurpleEdge 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