Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I wan know about the jquery validation -----

jquery validation for drop down with default value as "0".

Also have to validate cascading drop downs using jquery ...
Posted

 
Share this answer
 
Comments
IndiaMH 20-Feb-12 3:40am    
Hi,
I already tried for this this things
http://forum.jquery.com/topic/need-help-with-jquery-to-validate-dropdown-list[^]

But it doesn't work for me...

Here is my code sample
jQuery.validator.addMethod("notEqual", function (value, element) {
return value != param;
}, "*");

$(document).ready(function () {
jQuery.validator.messages.required = "*";
$("#form1").validate({
rules: {
ddlSample: {
//required: true,
notEqual: "- - Select - -"
}
messages: {
ddlSample: {
//required: "*"
}
}
});



Have any other solution for it
Set one options value as "".

Refer this:

To force a user to select an option from a select box, provide an empty options like <option value="">Choose...</option>

From : Plugins/Validation/Methods/required[^]
 
Share this answer
 
I Think This IS The Best :

See its source.

jQuery Validation Plugin Demo[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900