Determine if date was removed from date picker


Peter Bradstreet
Hi David,

I am using the date picker that is displayed in the DateInput2 example. In my app I need to act conditionally based on whether the due date is set or not.

If you add a button to your sample app and put this code on click: VarIsUndefined "datePickerValue" "Result" AlertBox "[Result]" "primary" You can see that this detects whether a date is selected or not properly. However, if you select a date and then either clear the date manually or press Pick->Clear the 'Result' is 'False' meaning that it thinks that there is still a date selected.

Any idea how I could detect that they have cleared the date ?

Pete

Peter Bradstreet
A little more info. In DateInput2 there are 3 scenarios for the value of 'datePickerValue'
1. date has not been selected yet: datePickerValue = "undefined"
2. date has been selected: datePickerValue = timestamp for date selected
3. date was selected and then cleared out: datePickerValue = "null"
So it seems that I need to look to see if the value of datePickerValue is either 'undefined' or 'null'. Could you please let me know what the correct syntax is for 2 conditions?
If "a" "==" "a" or "b" "==" "b" Do something here EndIf

DecSoft

Hello Peter,

Something like the below one?



Peter Bradstreet
Perfect thanks. Pete

DecSoft

No problem! :-)



Peter Bradstreet
Just in case anybody has a future use for this, there were a couple of typos in David's code. The correct code should be:

DecSoft

Hello Peter,

Yes; you are right... :-/


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.