enable/disable form functions by custom php code

stijnst 31 Mar, 2018
Hi

under Chronoforms v5 it is possible to enable (or disable) e.g. the email function of a form by using a custom php block:
$form->set("email_11", "enabled", 1);
I tried the same with Chronoforms v6 . I used a Logic/PHP function and replaced '$form' with '$this', as explained by the v5 to v6 migration FAQ, but I can't seem to get this working. I tried both the name and the designer label of the email function in the $this->set(); call

What part am I missing?
stijnst 31 Mar, 2018
oops, that code block was from a v4 installation, not a v5. but the question remains: how can this be done under v6?
GreyHead 01 Apr, 2018
Hi stijnst ,

I'm not sure if that method has an equivalent in CFv6. You can send an email conditionally using an Event Switcher action. Add a single 'send_email' Event in the Events box of the Event Switcher and Update Events; add your PHP in the Event Switcher and return 'send_email' if the condition is met. Lastly drag an Email action into the 'send_email' event and configure it.

Bob
This topic is locked and no more replies can be posted.