I have a CF7 form with two submit buttons with different texts, which should result in redirecting the user to different forms. For each button, under Behaviors, I select Local Vars, and then add a local variable named dir. I set the variable to different values for each button, PREV for the first and NEXT for the second.
In the actions for this form, I execute a segment of php code as follows:
$dir = $this->get("dir","");
if ($dir == "PREV") {$this->data ['page_num'] = 1;}
else {$this->data ['page_num'] = 3;}
but the first condition is never met, so the value of page_num always results in 3.
What am I doing wrong?
Is there another way to determine which button was clicked?
The way to do this is to give each button a different name, and check if the name exists in the form data or not, usually using a PHP action with Events behavior
And for best results you should use the new ChronoForms v8 which has the latest improvements and tutorials