ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

event switcher for 2 submit buttons

teldrive 25 Mar, 2014
Answer
:D Just to feedback with simple code how differentiate events for two submit buttons
in submit action you must insert event switcher and insert php code that uses different names off buttons

<?php

 if ($_POST['enviar']) 
 {
     return 'success';
 }
 elseif($_POST['guardar']) 
 {
     return 'fail';
 }
 ?>
BNDragon 09 Sep, 2014
😀 Just to feedback with simple code how differentiate events for two submit buttons
in submit action you must insert event switcher and insert php code that uses different names off buttons

<?php

 if ($_POST['enviar']) 
 {
     return 'success';
 }
 elseif($_POST['guardar']) 
 {
     return 'fail';
 }
 ?>

You saved my day😀

Reaaaallllyyyy Thanks man😉
GreyHead 11 Sep, 2014
Hi,

teldrive's code is fine - and here's a slightly updated ChronoForms version.

I would change the Events in the Event Switcher to be 'enviar' and 'guardar' (or 'send' and 'save' if you prefer) because these will be easier to understand when you come to re-edit the form later:
<?php
if ( isset($form->data['guardar']) && $form->data['guardar'] ) {
  return 'guardar';
} else if ( isset($form->data['enviar']) && $form->data['enviar'] ) {
  return 'enviar';
}
?>
You might also need to handle the case when neither is set!

Bob
BNDragon 12 Sep, 2014
Hi Bob,

To me 'enviar' and 'guardar' is just fine, since I'm portuguese. 😀

Your make a good point about the case when no option is set, I need to add that case.

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

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com