Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET4.0
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 19-Feb-12 21:48pm
IndiaMH353
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
IndiaMH at 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: bad
good
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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I Think This IS The Best :
 
See its source.
 
jQuery Validation Plugin Demo[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 20 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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