Form with 2 options, select one of the options - open differnt/ next form on submit

BrettVorster 04 Dec, 2014
Hi Guys,

I need you advice on the best way to do this. I have 2 forms, the primary one has a select box with 2 options. If you go with:
Option 1, the form opens a slider group and you fill that in and submit... All done.
Option 2, the slider group stays closed and you submit the form... But on submit I need the next form to open up.

So I've tried using the event switcher, with something like:
<?php
if ( $form->data['select'] == 'option1' ){
  return 'load';
elseif ( $form->data['select'] == 'option2' ){
  return 'submit';
}?>
And then have a Show Form action at the end that loads the second form on submit.... But its supposed to only load if its option 2 that has been selected at the moment no matter which option I choose it opens...

I must be doing something wrong here...

Please help
GreyHead 07 Dec, 2014
Hi BrettVorster,

Have you re-built the Custom Event Switcher list to include load and submit? If so, what actions do you have in the corresponding event boxes in the Custom Event Switcher action?

Bob
BrettVorster 07 Dec, 2014
Hiya Bob,

Thank you for writing back to me. Okay so starting off I wasn't so clued up on how this works but I downloaded your basics2 pdf and can now see I can add more events. Other than the Load and Submit.

I'm not 100% on how this works but I'm trying something like this now:

I have a 3rd event other than Load and Submit, I've called that Event Join. Because I want that event to trigger when the user selects the second option called Join - or AKA: 'option2' as described above.

So once they select join I need the event switcher to take action so that when they click submit it loads the second form called JOIN XYZ - which they fill in and submit without any great fanfare...

So with this even switcher where do I place it, in event Load or Submit?... At the moment I have it at the bottom of Submit event... I dont know about the build switcher list - when I click it nothing seems to happen... so all I see is success and fail... now I've just renamed the stuff to: return 'success'

And then would this be how my code would look:
<?php
if ( $form->data['select'] == 'option1' ){
  return 'fail'; // GOING THE NORMAL ROUTE - FORM COMPLETES 
elseif ( $form->data['select'] == 'option2' ){
  return 'success'; // GOING THE SCENIC ROUTE THE FORM COMPLETES AND THEN OPENS ANOTHER - PART 2
}?>

For now I have the 3rd event Join and Show form in there linking to the 2nd part form... But when I test the form, run the submit it completes without switching... I must be doing something wrong...
Max_admin 09 Dec, 2014
Hi Brett,

The "event switcher" works only after the form i submitted, do you want the new form to appear when the first one is submitted (using button click) or when the dropdown change is made ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.