Forums

dropdown menu leading to different links

Huonker 17 Jul, 2013
Hello
I have a question:
How is it possible to create a drop down menu with several options which will lead you to different pages(sites) depending on the choice you made, when the submit button is clicked.
I know how to create a drop down menu combined with a submit button with chronoforms. The only thing I do not know is how to direct to another site

Thank you
Best regards

Peter
GreyHead 18 Jul, 2013
Hi Peter,

You can do this with a Custom Code action in the On Submit event. It would look something like this:
<?php
switch( $form->data['select_name'] ) {
  case 'aaa':
    $url = 'some_url';
    break;
  . . . // more cases here
  case: 'zzz':
  default:
    $url = 'some_other_url';
    break;
}
$app =& JFactory::getApplication();
$app->redirect($url);
?>

Bob
Huonker 19 Jul, 2013
Hi bob
Thank you for your input. As I'm not really a programmist, is there also a way to leed someone to a site when he chose directly from the drop down menu.
As I don't want to have only one drop down menu on one page, but at least 3 different one it would not be very wise to have three different submit buttons, that's why it would be better when you get directly to the site when you select an item from the drop down menu, without a submit button. what is required to do so?
Thank you very much
Best regards

Peter
GreyHead 20 Jul, 2013
Hi Peter,

The simple answer is No.

You could just add a group of links to your page and let the user click the one that they want.

If you want to link anything to a drop-down then you are going to need to write at least a little code - or get someone else to write it for you.

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