Click here to Skip to main content
14,330,121 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

I Think This IS The Best :

See its source.

jQuery Validation Plugin Demo[^]
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100