ASP.NET client side validation with dataannotations - javascript minimumlength zero
- by Kordonme
Hi!
I'm doing client side validation on a project I'm working on. Everything works, except for the minimumlength property of the StringLength attribute (it works when submitting and a serverside validation is done):
[StringLength(50, MinimumLength = 6)]
The javascript generated by Html.EnableClientValication(); is the following:
// snip
{"FieldName":"User.Password","ReplaceValidationMessageContents":true,"ValidationMessageId":"User_Password_validationMessage","ValidationRules":[{"ErrorMessage":"The field Password must be a string with a minimum length of 6 and a maximum length of 50.","ValidationParameters":{"minimumLength":0,"maximumLength":50},"ValidationType":"stringLength"}]}],"FormId":"form0","ReplaceValidationSummary":false})
The important thing is here:
{"minimumLength":0,"maximumLength":50}
It produces javascript with the wrong minimumproperty. You guys have a hint? Is this a possible bug?