We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DatePicker OnChange event not firing when changing invalid javascript date.

Thread ID:

Created:

Updated:

Platform:

Replies:

123849 Apr 26,2016 02:58 PM UTC Apr 27,2016 01:20 PM UTC JavaScript 1
loading
Tags: ejDatePicker
Robert David
Asked On April 26, 2016 02:58 PM UTC

Hi.

We're currently in a situation where we want to alert the user why the date they have entered is being altered after it has been edited.

In the attached playground we can see the event fire in the console when we select from the list or we enter a valid date 01/01/2000

we get the event when we enter an out of range date (01/01/1969)

However we do not get the event when we enter 0000000000 or any other non-date value other than an empty input box which passes null as the value.

http://jsplayground.syncfusion.com/lushiwoh


Is there another event that fires before the value of the input is updated to the old/valid value?

Francis Paul Antony Raj [Syncfusion]
Replied On April 27, 2016 01:20 PM UTC

Hi Robert, 
 
Thanks for contacting Syncfusion support. 
 
Query: Is there another event that fires before the value of the input is updated to the old/valid value when we enter 0000000000 or any other non-date value other than an empty input box which passes null as the value? 
 
We have analyzed your query and checked the provided code example. By default ‘enableStrictMode’ property is set as false in ejDatePicker component. In this scenario, while you tried to enter the invalid date in textbox, model value doesn’t get changed/updated and it maintains the previous valid date only. So, in that case ‘change’ event doesn’t raised. 
Note: “change” event raises only whenever the model value get changed. 
If you have set ‘minDate’ property in DatePicker, and enter a valid date in textbox which is less than minDate, then the Date has been set to ‘minDate’ value and hence ‘change’ event raises. 
 
If you have set ‘enableStrictMode’ as true, you can enter the invalid date in the textbox. In this case entering invalid date causes, 
#1) error class (‘. e - error’) will get added to wrapper to highlight the invalid date. 
#2) model value changed from valid date to null (change event raises) 
 
For more information about enableStrictMode in DatePicker, Please refer to http://help.syncfusion.com/js/datepicker/behavior-settings#strict-mode 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Francis Paul A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;