Forum Moderators: open

Message Too Old, No Replies

Form handling question

         

grimlock

9:20 pm on Jun 19, 2004 (gmt 0)

10+ Year Member



Hello fellow webmasters, I'm trying to create a Drop Down Box Form which would redirect a client to different URLs depending on their selection from the drop down. I known this is simple but I need some help.

For example I have clients 1, 2, and 3.

I need them to login to their respective client areas. The list box would contain the choices Client1, Client2 and Client3 in the drop down.

After they select one and click the submit button it would take client1 to www.myclientarea.com/client1 and so on.

Any help would be highly appreciated.

Thanks

Abdelrhman Fahmy

10:02 pm on Jun 19, 2004 (gmt 0)

10+ Year Member



Hi grimlock
welcome to Webmasterworld,

you may use the following JS code (paste it before the closing </head> tag
*Note: this code will redirect them Automatically without the GO button



<script type="text/javascript" language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>

and then use the following code to add the dropdown menu



<select name="menu1" onchange="MM_jumpMenu('parent',this,0)" style="width:140px;" size="1">
<option selected="index.htm">Select Destination</option>
<option value="Client1.htm">Client 1</option>
<option value="Client2.htm">Client 2</option>
<option value="calient3.htm">Client 3</option>
</select>


Edit the clientsX.htm files from within the dropdown menu properties to match your destination pages.

grimlock

10:35 pm on Jun 19, 2004 (gmt 0)

10+ Year Member



Abdelrhman Fahmy that did the trick! Thanks a million!

dcrombie

11:05 am on Jun 20, 2004 (gmt 0)



Or you could scrap the DreamWeaver code and do it all in the SELECT box:

<SELECT onChange="self.location.href=options[selectedIndex].value;"> 
<OPTION value="index.htm">Select Destination</OPTION>
<OPTION value="Client1.htm">Client 1</OPTION>
<OPTION value="Client2.htm">Client 2</OPTION>
<OPTION value="calient3.htm">Client 3</OPTION>
</SELECT>