FAQs

How can I set an action parameter dynamically?

Written

Sometimes it would be helpful to be able to change some of the form action parameters dynamically. This is possible but treat with great care as it is easy to get unexpected results.

To do this you can add a Custom Code action. It needs to be in the same form event as the action you want to modify; and it needs to be before that action. In the Custom Code action add code like this

<?php
. . .
$form->actions_config[###]['parameter_name'] = 'some value';
. . .
?> 
the ### needs to be replaced by the id of the action you want to configure, this is the number that shows in the Setup tab just after the action title.
 
the 'parameter_name' needs to be the name of the parameter you want to change - you can check the page HTMl to see what this is. And,
 
the 'some value' needs to be replaced by a valid value for that parameter - take special care to make sure this is correct.