Skip to main content
May 6, 2020 6:58 AM UTC
Solved

Disable dates in Datepicker after today's date

Hi ,

i am looking for disabling the dates after current date . how can we do it in TWX 8.5 .

 

Thanks 

May 11, 2020 5:44 AM UTC
Here’s the code, it’s trivial:

endDate > new Date();

Use Validator function, enable its “Auto Evaluate” and bind its result to Disabled property of your primary action button, so that the user cannot continue if the selected date is in the future.

To improve user experience you can also add a Status Message function, which says something like “Please select a date in the past” and bind its Show service to True event of the validator.

9 replies

May 7, 2020 6:11 PM UTC

@VaibhavShinde.

 

Can you please provide the details of your use case?  It's not clear what you are attempting to do.

 

Regards.

 

--Sharon

May 7, 2020 6:13 PM UTC

I don't remember seeing that as an option.

You could always add validation.

Else you would need a custom widget or do the date picking with different controls that you have more control over.

May 8, 2020 4:36 AM UTC

Hi PaiChung,

ok , how can i call a validation script while selecting date in date picker ? do i need any event here to call script?

 

Thanks

 

 

May 8, 2020 12:58 PM UTC

I believe the date picker may have an 'on change' event, if not, then you would use your 'button click' that is invoking the service to run with the date selected.

In  the mashup you can then utilize the Validation function, so the 'event' would invoke the validation function and form there either inform the user (status message) or invoke the service you want to run.

May 10, 2020 11:29 AM UTC

Hello @VaibhavShinde,

 

Just bind the Output of the date/time picker to a validator parameter and select "Auto Evaluate" checkbox -- then this validator will be triggered every time you select a date.

 

Regards,
Constantine

May 10, 2020 1:14 PM UTC

Hi VaibhavShinde

I am reading your requirement as "do not allow" the users to pick the future date. In situations like selecting a date based on "Create date", create date cannot be a future date. Hence the date picker future dates should be greyed out. Is this the behavior you would like to have.

May 11, 2020 4:55 AM UTC

Hi @Swamy_Senthil 

 

Yes i have same requirement as you said. just i have input parameter named 'endDate' . i have to use function to validate the selected date. could you provide pseudo code in function? 

 

thanks

May 11, 2020 5:44 AM UTC
Here’s the code, it’s trivial:

endDate > new Date();

Use Validator function, enable its “Auto Evaluate” and bind its result to Disabled property of your primary action button, so that the user cannot continue if the selected date is in the future.

To improve user experience you can also add a Status Message function, which says something like “Please select a date in the past” and bind its Show service to True event of the validator.