views:

346

answers:

2

Hi

I don't know what is going but my jquery validate plugin(1.5.5) is not working and I am not sure for how long since I do most of my testing on firefox.

The problem is this I go to one of my forms that jquery validate on it and hit my "create" button my validation kicks in as it should and does this right in all browsers including IE8. Now where it does not work is when I do this.

I choose the first dropdown list and choose something. Then hit "create" now all validation errors should show up expect the one for the first dropdown box.

It does this in all browsers except in IE 8. I get this

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0) Timestamp: Sun, 8 Nov 2009 03:26:08 UTC

Message: Object required Line: 890 Char: 5 Code: 0 URI: http://localhost:3668/Scripts/Plugins-Development/jquery.validate.js

This is what is on line 890

return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);

This like the whole method block.

methods: {

 // http://docs.jquery.com/Plugins/Validation/Methods/required
 required: function(value, element, param) {
  // check if dependency is met
  if ( !this.depend(param, element) )
   return "dependency-mismatch";
  switch( element.nodeName.toLowerCase() ) {
  case 'select':
   var options = $("option:selected", element);
   return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);
  case 'input':
   if ( this.checkable(element) )
    return this.getLength(value, element) > 0;
  default:
   return $.trim(value).length > 0;
  }
 },

Not sure what is going on.

+2  A: 

There is a bug in the validation plugin. Make the change described here: http://osdir.com/ml/jQuery/2009-08/msg00151.html

Stephen
Intresting I actually added "option" to all my selectboxes and it seems to work. If it does not then I will try this.
chobo2
+1  A: 

This seems a known issue with Validation plugin and fix is available too. ValidationPlugin Issue page

Dil