Date Validation and user message

Dear Community

I want to add a date or date time pciker widget in the workshop and make sure that the user selects the date which is greater that current date.

for example if today is 17th mar 2025 – the user should select only dates greater than 17th mar 2025.

If user selects past or current date a message should appear saying please enter future dates only.

need guidance on how can I do that

Regards
Javs

Hi Javs, you could use a widget with conditional visibility that shows up with the warning message. It would be enabled if the date selected is compared to today/current date. You can make use of the “variable transformation” variables to formulate the logic

Hello JulioM

Thank you !! can you please specify which widget you are referring for.
I tried using section conditional visibility but this will not hold user from entering the date he can close the section or without closing continue giving the date right?

Regards
Javid

As JulioM mentioned one approach would be check if user entered day is after current day by using variable transformation. Create date variable that stores current day and another boolean variable using variable transformation, which compares if entered date variable is incorrect (on or before current day). This way value will be “false” when no date is entered. Depending on your situation you can choose to check if entered date is correct, but that would give you “false” value when there is no date selected in date picker. If using date and time widget and comparing only by date this would look like this:

Then you can create section below date picker with markdown widget or similar inside section and add error text to it. Configure section to be visible only when data is incorrect.

1 Like

I exactly did this same and its working for me.

I am thinking as below…please correct me if my thinking is wrong.

date entered by user – yesterday date
current date – today
the validation is user entered past date.
for which the Boolean variable got true
conditional visibility section got enabled. showing message please enter valid date.

here the section got visible but it not stopping the user from submitting with the yesterday’s date, he can continue the flow selecting other options and submit.

I am thinking the section will be conditionally visible and also user should not proceed further without entering the proper date.

This means I need to add another validation to the next button and trigger event only when the boolean variable if false? am i right ?

Regards
Javid

Yes, you are thinking in the right direction.

The easiest way would be to create another variable with the following configuration:

Then you can use this variable for a button state, for example hide button if no or wrong date is entered.

The result should be like this:

Date and time picker status Error message status Button status
No date selected Hidden Disabled/hidden
Date selected is before or on current date Visible Disabled/hidden
Date selected is after current day Hidden Visible
3 Likes

Thank you!! Really Appreciate

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.