Forums

event switcher based on submit buttons

mdma 17 Aug, 2015
Hello, iam struggling to make it work, the question was answerd severel times, i already tried out all code variants from forum and renaming buttons to same name, etc...i think this should work normally, but doesnt:
Button1/2:
Name buchen/anfrage
ID buchen/anfrage
Type Submit/Submit
Value/Label buchen/anfrage
---------------------------------------
On Submit->Event switcher:
Events: event_a,event_b

<?php
if ( isset($form->data['anfrage']) && $form->data['anfrage'] == 'anfrage'  ) {
  return 'event_a';
} elseif ( isset($form->data['buchen']) && $form->data['buchen'] == 'buchen' ) {
  return 'event_b';
}
?>

----------------------------------------
debugger in onLoad
Array
(
[chronoform] => anfrage
[event] =>
[buchen] => buchen
)
---------------------------------------
in the url there is nothing behind &event=

Anything missing?
Greetings
GreyHead 17 Aug, 2015
Hi mdma,

Is the Debugger in On Load or On Submit? If it is in On Load please add one to the On Submit event and post those results here.

What is the Submit event in the HTML (Render Form) action for your form? I don't understand why the event= is empty??

Bob
mdma 17 Aug, 2015
Answer
thankyou! i got it working now by deleting the "HTML render form".
Added it again freshly.

So the simple switch event does work now.
events:success,fail

<?php
if ( isset($form->data['anfrage']) && $form->data['anfrage'] ) {
  return 'success';
} else if ( isset($form->data['buchen']) && $form->data['buchen'] ) {
  return 'fail';
}
?>
This topic is locked and no more replies can be posted.