Forums

How to determine which of multiple submit buttons the user clicked

nlheath 1d ago

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?

You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger