32
Views
5
Comments
how to Prevent Users from entering date prior to 1900  years
Application Type
Reactive

this is not a date picker this is a text field that means the user can enter the value. 
In the provided field, users can manually input dates in the format MM/DD/YYYY. If a user enters a date such as 04/12/9000, it will be considered invalid as it exceeds the acceptable range. However, if the user enters a date like 04/12/1900 or any year above 1900, it will be considered valid. 

2020-01-01 07-11-22
Pravi Gupta

Hi,
You can apply the date validation on the OnChange Event of the InputBox.
At the start of the OnChange action, first you can check is -
If it is a Valid Date, if yes, then have the validation.
Else, ignore it, until user types a complete date.

UserImage.jpg
Pratik Dhole

i am adding an Onblur event, compare years like this but this is not valid 

2020-01-01 07-11-22
Pravi Gupta

Instead of doing this, you should convert it into a Date Data Type (by using TextToDate() function) and extract the Year of that date to apply the validation.

To extract the Year from a date, you can use Built in Year() function.


Accessing the string split list via Indexes can risky as well, when the user does not enters the complete date and taps out. In that case, you might get Index Out of Bounds error.

2024-04-19 08-26-30
syerasyl

within properties of input widget set max & min attributes as needed

2023-10-21 19-42-11
Tousif Khan
Champion

Hello

First I suggest you to use date, because of various reasons like if you use by default date type it is easy to mange thing on client side as well as server side while saving the data.

However if you want to check the date you can use the Year function like

make sure you will write the other validation as well to not allow the user to add values before.

But I strongly suggest to use Date picker instead of text input.
Attaching a sample

Thanks
Tousif Khan

POCAPP_Date.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.