cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Disable dates in Datepicker after today's date

VaibhavShinde
16-Pearl

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 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

9 REPLIES 9

@VaibhavShinde.

 

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

 

Regards.

 

--Sharon

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.

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

 

 

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.

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

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.

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

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.

Hi ,

Thank you all for clearing the concept. 

@Constantine , worked for me.

 

Thanks

Top Tags