Forums

Show form after radio button choice

Vizinho 30 Jul, 2014
Hi!
Small question, big problem (at least for me)!

I want that when the user chooses "Option A" or "Option B" a different form be presented for him to fill.

Can you point me ideas on how I can achieve this?

Thank you.
Vizinho 31 Jul, 2014
I hope this is not a silly question!
I believe not.

First I thought on using two fieldsets and then conditionally try to make them enabled or not.
As I need to have the form results sent to email I'm figuring the mess it could be...

That's why I start thinking on building two distinct forms and then make them appear conditionally on a third form.
I also read some things about an action to load a form but I don't find it in version 5. Is it still available?

How would you build something like what I described? I thank you for any inputs.
GreyHead 01 Aug, 2014
Hi Vizhino,

I agree with you that using three forms - one to select the option, then two more to follow up - is the easiest way to handle this.

The Redirect action in the Utilities actions group together with an event switcher will handle the redirection. Just add the URLs to the secondary forms. If you need to pass data that has been entered on the Options form then use the Data to Session and Session to Data actions.

Bob
BNDragon 09 Sep, 2014
Hello Bob,

This is exactly what I need, but I don't understood how can I use the event switch, cam You give me a small example?
How do I redirect my user to the FormA if he chooses the value 1 in the option of a drop down, and redirect to FormB if he select the value 2?

Thanks for your help.

BN
BNDragon 09 Sep, 2014

Hello Bob,

This is exactly what I need, but I don't understood how can I use the event switch, cam You give me a small example?
How do I redirect my user to the FormA if he chooses the value 1 in the option of a drop down, and redirect to FormB if he select the value 2?

Thanks for your help.

BN



Forgot to tell that my joomla is 3, not 2.5, sorry.

Thanks once more.

BN
BNDragon 09 Sep, 2014
Sorry to reply again without an answer, but I need help in this.

Tell me if you guys can reply here or I need to create another topic.

Sory once more and thanks.
BNDragon 09 Sep, 2014
Hi again,

Not exactly what I wanted, but it do his work.

Just created several submit button (in my case 3) and then just test what was the one who submited.
Is my code:

<?php

 if ($_POST['submit10']) 
 {
     return 'formArq';
 }
 else if ($_POST['submit11']) 
 {
     return 'formEmp';
 }
 else if($_POST['submit11']) 
 {
     return 'formDes';
 }
 ?>


Thanks to

: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';
 }
 ?>



Cya ^.^
This topic is locked and no more replies can be posted.