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

How to disable previous dates in datepicker widget

SOLVED
sabhz
Garnet

How to disable previous dates in datepicker widget

I need to select dates only from September month and need to disable rest of the previous dates in date picker widget. 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to disable previous dates in datepicker widget

Only in DateTimePicker "Range" selection condition, the end date cannot be earlier than start date, will the dates in the picker be disabled and become grey.

 

And I can't find ways to compare time in Expression any more. Didn't know if I used wrong script or it's been disabled.   Time1 - Time2 = time difference (integer) used to work, and then (Time1 - Time2)>0 can be used in time comparison.

View solution in original post

6 REPLIES 6

Re: How to disable previous dates in datepicker widget

You may not able to disable widget from selecting the time before today, but you can use a Validator Function in the mashup, to identify if the new StartDate input is earlier than the limit (trigger by Widget's Changed event), if so, a Warning message will show up;

You may also trigger a service to assign today's time to the widget if the startDate is earlier

Re: How to disable previous dates in datepicker widget

Hi Thanks for you suggestions,
can i get sample code for validator ??

Re: How to disable previous dates in datepicker widget

Gave up using Expression, can't remember how to make it work.

 

I actually did this:

1. create a service in Thing, with script var result = time<new Date();  time is the input, output is boolean;

2. Add this service to mashup, add the timepicker to its input

3. create a Label widget saying "Time should not be earlier than today"

4. bind the service result to "Visible" of the Label widget, and trigger the service by timepicker "Change" event

 

Now it works

Re: How to disable previous dates in datepicker widget

Hi Thanks again for your ideas,

 

I also used this method long back but now i need to disable previousdays like how now we are disabling futuredays in widget properties.

I would like to know that type of smiliar approach or any other possiblities to do that.

Re: How to disable previous dates in datepicker widget

Only in DateTimePicker "Range" selection condition, the end date cannot be earlier than start date, will the dates in the picker be disabled and become grey.

 

And I can't find ways to compare time in Expression any more. Didn't know if I used wrong script or it's been disabled.   Time1 - Time2 = time difference (integer) used to work, and then (Time1 - Time2)>0 can be used in time comparison.

View solution in original post

Re: How to disable previous dates in datepicker widget

Hi @sabhz.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.