views:

93

answers:

1

Hi.

On one of my models I have a property annotated with:

[StringLength(60, ErrorMessage="Title must be between 60 and 10 characters", MinimumLength=10)]

When the form posts to the server, if it's under 10 characters, then validation fails as it should do. However, on the client-side, it only checks that it's under 60 characters -- not also above 10 characters.

Here's the JSON, note that the minimum length is 0:

<![CDATA[if (!window.mvcClientValidationMetadata) { window.mvcClientValidationMetadata = []; }window.mvcClientValidationMetadata.push({"Fields":[{"FieldName":"Title","ReplaceValidationMessageContents":true,"ValidationMessageId":"Title_validationMessage","ValidationRules":[{"ErrorMessage":"Title must be between 60 and 10 characters","ValidationParameters":{"minimumLength":0,"maximumLength":60},"ValidationType":"stringLength"}]};//]]>
+2  A: 

It appears to be a bug in MVC 2 that was fixed in MVC 3

BuildStarted