I have a drop down of 3 items and each item has a different form. After selecting and submitting "item 1" it is supposed to load "form 1". I would like to know how I should do it.
Forums
How do I load a different form after I submit the current form
You can use an "Event switcher" action and setup 3 events for the 3 options and use 3 redirect actions, each to a different form.
Regards,
Max
Regards,
Max
I used the Event switcher action, setup 3 events for the 3 options and redirect actions but it redirects to the 1st form for all the 3.
My drop down ID is "liketodo". The options are 0=View a Bible, 1=Reserve a Bible, 2=Purchase a Bible. Each one has a different form i.e ("view-bible", "reserve-a-bible", purchase-a-bible") respectively but they all load "view-bible" form after submitting.
Below is the code for the Event Switcher I am using; please check whether this is correct;
<?php
if($form->data['liketodo'] == 0){
return "view-bible";
}
if($form->data['liketodo'] == 1){
return "reserve-a-bible";
}
if($form->data['liketodo'] == 2){
return "purchase-a-bible";
}
?>
My drop down ID is "liketodo". The options are 0=View a Bible, 1=Reserve a Bible, 2=Purchase a Bible. Each one has a different form i.e ("view-bible", "reserve-a-bible", purchase-a-bible") respectively but they all load "view-bible" form after submitting.
Below is the code for the Event Switcher I am using; please check whether this is correct;
<?php
if($form->data['liketodo'] == 0){
return "view-bible";
}
if($form->data['liketodo'] == 1){
return "reserve-a-bible";
}
if($form->data['liketodo'] == 2){
return "purchase-a-bible";
}
?>
[attachment=0]Firefox_Screenshot_2014-12-28T12-53-36.449Z.png[/attachment]
[attachment=0]Firefox_Screenshot_2014-12-28T12-57-26.453Z.png[/attachment]
The first image doesn't have an "event switcher" action, you have a "Custom code", that's wrong, the Event switcher action will have 3 events where you should place your 3 redirect actions so that the switching can be done based on the value.
Regards,
Max
Regards,
Max
Thanks Max,
I have setup "Event Switcher" action with 3 events and 3 redirect actions. After submit it does not load the respective form. Am not so good with coding, I hope to help me in this please.
Attached are images;
[attachment=0]Firefox_Screenshot_2014-12-30T21-10-14.766Z.png[/attachment]
[attachment=1]Firefox_Screenshot_2014-12-30T21-12-04.099Z.png[/attachment]
The event switcher code i put in is;
<?php
if($form->data['liketodo'] == 0){
return "view-bible";
}
?>
<?php
if($form->data['liketodo'] == 1){
return "reserve-a-bible";
}
?>
<?php
if($form->data['liketodo'] == 2){
return "purchase-a-bible";
}
?>
I have setup "Event Switcher" action with 3 events and 3 redirect actions. After submit it does not load the respective form. Am not so good with coding, I hope to help me in this please.
Attached are images;
[attachment=0]Firefox_Screenshot_2014-12-30T21-10-14.766Z.png[/attachment]
[attachment=1]Firefox_Screenshot_2014-12-30T21-12-04.099Z.png[/attachment]
The event switcher code i put in is;
<?php
if($form->data['liketodo'] == 0){
return "view-bible";
}
?>
<?php
if($form->data['liketodo'] == 1){
return "reserve-a-bible";
}
?>
<?php
if($form->data['liketodo'] == 2){
return "purchase-a-bible";
}
?>
Hi gilgal_media,
There can be problems using 0 and 1 as option values*. I'd suggest that you change those to more meaningful values:
Then the event switcher can just use:
Bob
There can be problems using 0 and 1 as option values*. I'd suggest that you change those to more meaningful values:
view-bible=View a Bible
reserve-a-bible=Reserve a Bible,
purchase-a-bible=Purchase a Bible
Then the event switcher can just use:
<?php
// set a default value if liketodo is missing or empty
if ( !isset($form->data['liketodo']) || !$form->data['liketodo'] ) {
$form->data['liketodo'] = 'view-bible';
}
return $form->data['view-liketodo'];
?>
Bob
Thank you Bob for your assistance, however after changing everything & submit I receive this error;
=============
Parse error: syntax error, unexpected T_BOOLEAN_OR, expecting ',' or ')' in /home/gilgalme/public_html/view.gilgalmediaarts.com/wp/wp-content/plugins/chronoforms/admin/chronoforms/actions/event_switcher/event_switcher.php(26) : eval()'d code on line 3
=============
Here are the images;
=============
Parse error: syntax error, unexpected T_BOOLEAN_OR, expecting ',' or ')' in /home/gilgalme/public_html/view.gilgalmediaarts.com/wp/wp-content/plugins/chronoforms/admin/chronoforms/actions/event_switcher/event_switcher.php(26) : eval()'d code on line 3
=============
Here are the images;
Hi gilgal_media.
Sorry, I missed a ) in this line:
:-(
Bob
Sorry, I missed a ) in this line:
if ( !isset($form->data['liketodo']) || !$form->data['liketodo'] ) {
:-(
Bob
Thanks so much Bob,
The code works and does not return the error anymore now. However the intended form is not displayed. I think problem is in the "redirect" action.
It is supposed to redirect to a form "view-bible". Please help me with the "redirect" action code. Below image is what i used.
The code works and does not return the error anymore now. However the intended form is not displayed. I think problem is in the "redirect" action.
It is supposed to redirect to a form "view-bible". Please help me with the "redirect" action code. Below image is what i used.
This topic is locked and no more replies can be posted.