Forum Moderators: open

Message Too Old, No Replies

form select options problem

Only one 'jumps' to another page but all try

         

raggarsvin

11:21 am on Dec 4, 2002 (gmt 0)



I have this Select tag in a form and I need the last option to make a jump to another page but the two first options just to be a value for a script that is specified in the form action...

<select class="form" name="select" size="1">
<option value="namn">F&ouml;retagsnamn</option>
<option value="bransch">Produkt &amp; tj&auml;nst</option>
<option value="/sok/branschtorg/index.html">Branchtorget</option>
</select>

if I do the first line like this:

<select class="form" name="select" size="1" onChange="MM_jumpMenu('parent',this,0)">

ALL options try to jump to another page wich i do not wish

so, anyone who can help me out?

BlobFisk

2:19 pm on Dec 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome [webmasterworld.com] to WebmasterWorld, raggarsvin.

You could write a small JavaScript function that checks the value of the select field. If the value is equal to the value that you want to reidirect on, then change the document.location. If it's not, do nothing.

The onChange in your select field now runs that function.

raggarsvin

10:48 pm on Dec 4, 2002 (gmt 0)



wouldnt such a script only do the thing i want when i click a button?

this is what i want to do....

i select option 1 or 2 and nothing happens,(until I puch the button and process the form) BUT when I select the 3:th option i want an instant redirect to another page

jatar_k

9:13 am on Dec 5, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld raggarsvin,

you can still use onChange but it would seem that right now it trys to jump no matter what.

in your onChange you call a function
the function should do something like,

if the value selected is 3
redirect to some page
else
do something else