Forums

Stop form after a certain date

hekla 05 Jan, 2019
I have an event registration form with chronoforms v6 and would like to have add the functionality, that the form will not be displayed after a certain date, which I load with Read Data from the DB.

Then I could add an if-then statement:
if(time() >= strtotime($this->get("read_data3.title.enddate"))) { STOP COMMAND }

Which command could have the effect to stop the form from being displayed and instead to display custom code ?

Any help is appreciated.
healyhatman 05 Jan, 2019
Use a PHP block with
return time() >= strtotime($this->get("read_data3.title.enddate"));
Then a switch with data source set to
{fn:your_php_block}{var:your_php_block}
Then do something like this
true:{event:show_form_unavailable_page}
false:{event:load_form}
Erik66 09 Jan, 2019
Could you perhaps solve this with an Event Switcher in the actions ?
healyhatman 09 Jan, 2019
For some reason I thought this was in Chronoconnectivity. Yes, do it with an event switcher.
hekla 18 Jan, 2019
Thanks for your answers.
Can you give me a hint how to do it with an Event Switcher. I haven't used it yet, so I don't fully understand its functionallity.

Thank you
healyhatman 18 Jan, 2019
Sure set your events to true, false. Display the form in false, display an error in true. Or the other way around whatever makes sense
hekla 05 Feb, 2019
Hi

I didn't succeed in figuring it out.

My thoughts:

I have a PHP block named "date-to-deactivate" I call the date from my DB (+3 days = 259200sec):


In event switcher I have




But no effect.

What did I miss?
hekla 05 Feb, 2019

Try "true, false"


instead of "1,0"?
No difference.
healyhatman 05 Feb, 2019
{fn:} is something used in Chronoconnectivity, you should be using {var:}

Also you can simplify it a little with
return time >= strtotime($this->get("read_data3.title.enddate") . " + 3 days"));
This topic is locked and no more replies can be posted.