Hi there,
This is actually quite a tricky one but I believe I have it working now.
There are a few things to keep in mind.
- Rules do not require an if statement unless it is nested, when you are comparing multiple values you should use and/or
- You will need to make sure the date value is also filled so it will require a isNullOrEmpty() check
- You will need a date and time to compare to, sadly there is no quick and easy way to get this so you have to build form variables to allow this.
With that in mind this is the formula I used.
and(equals(Completed,true),or(greaterThanOrEqual({Self},DateTimeNow),isNullOrEmpty({Self})))
Completed is the same variable you use
{Self} is the preferred method to refer to the control the rule is running on, similar to a this()
DateTimeNow is a construct form variable built that combines Date and Time together into a single variable, to make that, follow the steps below.
- Open the forms variables panel
- Add a new variable and call it DateTimeNow str and configure as follows:
Formula used: formatDate(Current Date,'ddMMyyyy')+ formatDate(Current Time, 'HHmm;')
- Add another variable called DateTimeNow and configure as follows:
Formula used: date(subString(DateTimeNow str,0,2), subString(DateTimeNow str,2,2),subString(DateTimeNow str,4,4),subString(DateTimeNow str,8,2),subString(DateTimeNow str,10,2))
As you can see with the rule used I get validation error when trying to submit.
Kind regards
Jake