Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I need to select dates only from September month and need to disable rest of the previous dates in date picker widget.
Solved! Go to Solution.
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.
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
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
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.
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.
Hi @sabharees.
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