I need to implement following validations in MVC
1. Date field
A field can accept only mm/dd/yyyy format and should be in a year range between 1753-9999 and other basic checks like Leaf year and 30, 31 days
Sometimes a field can accept a text 'N/A'(not applicable)
Also date should be greater than start date.
2. Numeric field
Should accept valid numbers from 1 to 100 , if decimal 0.1 to 99.99
Can accept N/A
3. Dependency Field
This field is required only if another field has a value.
4. Triggers
If this field value is A->B then it should affect other field values that are editable.
Is there any library for MVC 3 supports all? Or do i combine Foolproof and standard MVC validations? Any suggestion for implementing my above needs?
Why don't you take advantage of HTML5
for Time
@Html.TextBox("timeFrom", DateTime.Now.AddHours(2).ToString("HH:mm"), new { type = "time", size = 3, step = "1" })
for date
@Html.TextBox("Mydate", new { required = "required", type="date" })
for number
<input type="number" name="quantity" min="1" max="100">
@Html.TextBox("number", new {type="number" name="quantity" min="1" max="100"})
for dependency field you can use system.componentmodel. data annotations