jquery validation remote validation rule depending if body has a class name -


i using jquery validate plugin validate form.

one field has remote rule checks make sure value entered isn't in database. rule used 2 different pages , both have different body class identifies them validation rule.

the problem it's failing on depends rule remote validation never happens. if remove depends part, remote validation works.

what wrong depends part make fail?

$("form").validate({         errorclass: "autherror",         errorelement: "div",         rules: {             some_field: {                 required: true,                 remote: {                     depends: function() {                         return $('body').hasclass('some-class');                     },                     type: 'post',                     url: '/check.php',                     data: {                         'something': $('#some_field').val()                     }                 }             }, 

i fixed so

some_field: {     required: true,         remote: {             param: {                 url: '/check.php',                 type: 'post',                 data: {                     'something': $('#some_field').val()                 }             },             depends: function() {                 return $('body').hasclass('some-class');             }         }     }, 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -