Welcome Guest Search | Active Topics | Sign In | Register

MinValidDate when using DatePicker... Options
rvaneynd
Posted: Monday, October 27, 2008 1:05:09 PM
Rank: Newbie
Groups: Member

Joined: 10/27/2008
Posts: 4
Is it possible to show a pop-up message when you enter a date that is old than the MinValidDate?

I have a situation where people are asking if it is possible to have a message shown when entering a non valid date.
If they select the calendar it works fine as Non valid dates are blocked. But the problem shows it self when the person enters a date that is older than the MinValidDate.

In that case DatePicker auto corrects to the MinValidDate, which is not that obvious to the user.

Regards,
rvaneynd
eo_support
Posted: Monday, October 27, 2008 1:15:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can easily get the DatePicker's current value, compare it with your valid date range and display an error message if needed by JavaScript. An example demonstrating this can be found here:

http://www.essentialobjects.com/Demo/Default.aspx?path=Calendar\_i2\_i0

The difficult part is when to call such validation code. The easiest approach is to call it before you submit the page. For example, if you have a "Save" button that submits the page, you can attach an onclick JavaScript handler to your "Save" button. You can then perform the validation and return false inside that handler. A more sophisticated method is to handle the validation when the DatePicker control loses focus. In another word, you would handle the DatePicker's onblur event instead of your "Save" button's onclick event. You can find details about this approach at here:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=1888

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks
rvaneynd
Posted: Tuesday, October 28, 2008 6:13:27 AM
Rank: Newbie
Groups: Member

Joined: 10/27/2008
Posts: 4
Hi,

Thank you for the advice. We will try to implement the onblur event.

rvaneynd


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.