Hi - I want to ensure that any date entered in a form is no more than 7 days ago.
I know how to ensure that the date is greater than current by using the {NOW} expression.
Does anyone know the syntax for 7 days ago? {NOW-7} and {NOW}-7 don't work.
Thanks in advance,
Michael Bullard
Date Validation
Re: Date Validation
Hi Michael
You obviously need to add a "Throw Error" behavior to the form and link it to your "date" field.
Then build your condition (Advanced Tab) like this:
{date} is your input field that you select from the dropdown for expression 1
This is what the line of code should look like when you are done
You obviously need to add a "Throw Error" behavior to the form and link it to your "date" field.
Then build your condition (Advanced Tab) like this:
Code: Select all
{date} < date('Y-m-d', strtotime('-7 days'))
This is what the line of code should look like when you are done
Code: Select all
$customTransaction->registerConditionalTrigger("{date} < date('Y-m-d', strtotime('-7 days'))", "BEFORE", "Trigger_ThrowError", 50);
Re: Date Validation
Hi Fred,
Thanks for your help, this works very well. I even managed to include a dynamic date for 7 days ago in the error message, using a dummy recordset.
I have not really used the Throw Error function before - this has been a real eye opener.
Michael
Thanks for your help, this works very well. I even managed to include a dynamic date for 7 days ago in the error message, using a dummy recordset.
I have not really used the Throw Error function before - this has been a real eye opener.
Michael