Problem:
I am using Peter Blum’s Professional validation controls (http://www.peterblum.com/DES/MoreValidators.aspx) throughout my project and have come across a validation that should be done on the client side rather than going back to the server. The screen needs to send two dates(month/year) to the server, one for start date and one for end date. The dates are only month/year using Peter’s MonthYearTextBox (http://www.peterblum.com/DES/DemoMoreDAT.aspx#MYTB). The two dates must not be more than 3 months apart (please note I did not say 90 days apart).
Here is the end goal:
A user comes to the screen to run a report. They are prompted for a start date (Month/Year) and an end date. These dates get sent to the server so that the report can be generated for the items within this date range. The user can only run this report for any 3 month period.
What I’ve Done:
I started off by using the DifferenceValidator from Peter’s Validation And More package. In doing so, I set the difference that I expected to be 90 days, however soon realized that 7/2009 – 10/2009 is a 3 month difference (which is allowed) however it is a 92 day difference (which is outside the validator’s range).
Question:
Is there any way that I can override the evaluation function in a client side function so that I may compare the month portion of the dates that are being evaluated?
Thank you,
Scott Blue
Yes there is. Here’s a Javascript example:
And you have to specify CustomEvalFunctionName=”ValidateDateRange” in order for this to work.
I believe the CustomEvalFunctionName is supported in all of the different Peter Blum Validation controls.