Reputation: 19
I am using jQuery validation plugin and this question is about conditional validation of minlength and maxlength rules.
I have a dropdown list and a textbox. If the user selects a particular value in dropdown list the textbox minlength should be 13 characters,maxlength should be 19 characters. For other dropdown values minlength and maxlength should be 16 characters.
Help appreciated. Thanks a lot
Upvotes: 1
Views: 1598
Reputation: 6446
you can try like this
rules:
{
ControlName:
{
minlength:function (element) {
you can write your code to check your conditions
}
}
}
Upvotes: 2