Ah, good catch. I forgot that the text is used as a value when no value-attribute is provided. Good to know you got it working!
Jörn On Tue, Feb 3, 2009 at 3:10 AM, Kathryn <kathry...@gmail.com> wrote: > > Jörn, > > Many thanks for the clarification and tip. When I removed the value > attribute completely, it didn't work, but when I left it in with no > value, the error message came up as expected. The code below works. > > Thanks again-- > > Kathryn > > <select name='class_date' id='class_date' class='required'> > <option value=''>--Select One--</option> > <option>Feb 16 - 20, 2009</option> > <option>Mar 16 - 20, 2009</option> > <option>Apr 13 - 17, 2009</option> > <option>May 11 - 15, 2009</option> > </select> > > On Feb 1, 4:54 am, Jörn Zaefferer <joern.zaeffe...@googlemail.com> > wrote: >> Dropdowns are supported just fine. Just remove the value attribute >> from the "select one" option and add a required rule for the field. >> See >> alsohttp://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo... >> >> Jörn >> >> On Sat, Jan 31, 2009 at 7:59 PM, Kathryn <kathry...@gmail.com> wrote: >> >> > Hi all, >> >> > I'm using the fantastic validation plugin (from bassistance.de) and >> > have run into a little glitch. I understand the plugin doesn't >> > currently handle dropdowns, but I found a possible solution on True >> > Tribe (http://www.thetruetribe.com/jquery/1-jquery-api/68-jquery- >> > plugin-validation-with-ajax). I can't get it to work, though. I'm >> > pretty new to jQuery and am probably making an obvious error I can't >> > see. Here's my jQuery code: >> >> > $(document).ready(function(){ >> > $("#reg_form").validate({ >> >> > onfocusout: false, >> > onkeyup: false, >> > onclick: false, >> >> > rules: { >> > gender: {required:true}, >> > spouse_attend: {required:true} >> > } >> >> > }); >> >> > $validator.addMethod( >> > "select_class", >> > function(value, element) { >> > return this.optional(element) || ( value.indexOf("--Select One--") >> > == >> > -1); >> > }, >> > "Please select a class."); >> >> > }); >> >> > And here's the dropdown I'm trying to validate. >> >> > <select name='class_date' id='class_date' class='select_class'> >> > <option value='--Select One--'>--Select One--</option> >> > <option>Feb 16 - 20, 2009</option> >> > <option>Mar 16 - 20, 2009</option> >> > <option>Apr 13 - 17, 2009</option> >> > <option>May 11 - 15, 2009</option> >> > </select> >> >> > What am I doing wrong? Or is there another way to do this? >> >> > Thanks in advance! >> >> > Kathryn