I'm trying to redirect users to different URL's after pushing submit depending on which option they choose in a radio box. I'm new to using Chronoforms and I'm not sure how do that.
Hi Joybelle,
Fastest way to do this is using some PHP code, this is needed if your URLs are completely different.
Add a "Custom code" action in the "on submit" event and use this code:
Make sure your place the correct field name and links in the code above.
Regards,
Max
Fastest way to do this is using some PHP code, this is needed if your URLs are completely different.
Add a "Custom code" action in the "on submit" event and use this code:
<?php
$mainframe =& JFactory::getApplication();
if($form->data['radio_field_name_here'] == 'x'){
$mainframe->redirect('http://www.chronoengine.com');
}else if($form->data['radio_field_name_here'] == 'y'){
$mainframe->redirect('http://www.chronoengine.com/forums/');
}
?>
Make sure your place the correct field name and links in the code above.
Regards,
Max
Thanks Max. I entered the custom code but it redirects me to a blank page. If I have more than 2 radio buttons would the x and y value have to change? I entered the field name and the url within the brackets and parenthesis but I'm not sure where I'm going wrong. Thanks
Hi joybelle,
Exactly what code have you used? Please copy and paste it here.
Bob
Exactly what code have you used? Please copy and paste it here.
Bob
I used this
<?php
$mainframe =& JFactory::getApplication();
if($form->data['input_radio_0'] == 'x'){
$mainframe->redirect('http://kevinhull.org/index.php/events?id=83');
}else if($form->data['input_radio_2'] == 'y'){
$mainframe->redirect('http://kevinhull.org/index.php/events?id=84');
}else if($form->data['input_radio_3'] == 'y'){
$mainframe->redirect('http://kevinhull.org/index.php/events?id=85');
}else if($form->data['input_radio_4'] == 'y'){
$mainframe->redirect('http://kevinhull.org/index.php/events?id=86');
}
?>
Hi joybelle,
The 'x' and 'y' values depend on the values of the checkboxes in your form. You need to match these up so that the logic works.
If you are getting a blank page with just the template them probably none of the 'if's are being met and you are seeing an empty 'Thank You' page.
Bob
The 'x' and 'y' values depend on the values of the checkboxes in your form. You need to match these up so that the logic works.
If you are getting a blank page with just the template them probably none of the 'if's are being met and you are seeing an empty 'Thank You' page.
Bob
Hi all,
I am not a programmer, but thanks to this post, I solved similar issue with select box field.
This is the code:
In my case, select box name and ID is "searchengine" and there are 3 options: Google, Yahoo and Bing.
By the way, thanks for hard work guys. ChronoForms rocks!
I am not a programmer, but thanks to this post, I solved similar issue with select box field.
This is the code:
<?php
$mainframe =& JFactory::getApplication();
if($form->data['searchengine'] == 'Google'){
$mainframe->redirect('http://www.google.com');
}else if($form->data['searchengine'] == 'Yahoo'){
$mainframe->redirect('http://www.yahoo.com');
}else if($form->data['searchengine'] == 'Bing'){
$mainframe->redirect('http://www.bing.com');
}
?>
In my case, select box name and ID is "searchengine" and there are 3 options: Google, Yahoo and Bing.
By the way, thanks for hard work guys. ChronoForms rocks!
This topic is locked and no more replies can be posted.