Hey guys,
I am facing one scenario in my project where I have one date input field.
For this field, I have to add validation for Invalid dates like: 31/09/2023 , 30/02/2023 ,...
Also half filled dates like: MM/03/2023 , 08/DD/2023, MM/DD/2023 ,....
I created one action - OnBlur for the date field and check whether the date is invalid. In OS, the above invalid dates returning default date - 01/01/1900. So I checked whether the date is different from 01/01/1900. If it is different, i am not going to show any error. if it is 01/01/1900 , I am showing a validation error message as follows.
But what is the main issue I am facing is, When the user clicks into the date field and clicks away from it without entering any value, that time also it is returning the default date 01/01/1900 and showing the error message, which is not supposed to show and I tried various methods. Any help or idea on this would be really appreciable.
Thanks in advance,
Kiruthika
Hey,
Is there any chance you could use your date validation on your submit or next button action instead of using it on OnBlur action?
That will result in error only when the date is null and not when user just clicked on it.
Thanks,
Komal
Hi Kiruthika, I don't think you need to handle that explicitly in the on blur. If the date is invalid (e.g. 12/dd/yyyy or 09/31/2023, the value that is passed in is a null date.
You can then handle it in the on submit to check if the value is null date, for cases where the date is mandatory.
Hey @Kiruthika Balasubramanian ,
I have already posted the solution for the similar kind of problem.
https://www.outsystems.com/forums/discussion/91501/sort-list/
Use the below code in if condition:
Index(DosLfd,"1900") = -1
Explanation:
Null date means 01/01/1900. It contains 1900.So if 1900 exists in "DosLfd" it means that "DosLfd" is null date.
I hope it will work.Try this approach and let me know.
Thanks & Regards,
Sudip Pal