Or selects a date from 1800 or even earlier than that!
We should create an application that should stop the user from selecting invalid dates.
No matter what version of jquery or unobtrusive I use the range validator works fine but as soon as I switch to v1.11.0 of jquery.validate it breaks down.
I tried to run file compare on the old and new version but there is just to many differences so i leave the solution to you geniuses out there...
First the Text Box for getting the DOB from the user and the other for showing the age.
All rules work both with Html5 inputs whose value format is international ISO, and falled back inputs working with current locale formats.
Gone those days where you write long java script functions for date validation and alert/show a error message on screen.
It will be a nice feature where you don't allow end user to make mistake.
Data Annotations package provides a vast range of Data Annotations attribute, but there are certain scenarios where we need something which is very specific to our business requirements and we need to implement our own Validation Attributes. NET being an extensible framework which makes it possible for the developer to add user defined custom business validations using custom data annotations.
Now we are ready to override the Is Valid method where we are going to implement the actual business rule validation.
I have used Switch statement here to check which Validation Type the user is requested for. Here Validation Result represents a container for the results of a validation request.
In the code above I am keeping the form method as post and Action to my Date Validation Action of Home Controller.
This quick post shows how to validate two date fields by comparing their values.