0

if a or b selected from select menu i want to submit values else other is selected from select menu i want to redirect to other website please help me urgent.

** my form code is **

 <table> 
 <tr>

    <td><label>
      <select name="community" id="select7" >
        <option value="a">a</option>
        <option value="b">b</option>
        <option value="other">other</option>
      </select>
    </label></td>
  </tr>
  <tr>
    <td><input type="submit" name="button" id="button" value="search" tabindex="50" /></td>
  </tr>
</table>

Thanks you,

3
Contributors
3
Replies
23
Views
4 Years
Discussion Span
Last Post by gssr
0

I think this is a JavaScript question, also, the label tags are wrong and nothing will work if it's not within <form></form> tags

1

Change line 5 to:

<select name="community" id="select7" onchange="javascript:if(this.value=='other')window.location.href='REDIRECT/PATH/HERE';">

If you need this to be more scalable, you can make it a JS function instead.

EDIT: Good catch, TonyG. Those <label> tags don't belong there, and while the onchange will handle redirects, submitting won't work without <form> tags.

Edited by EvolutionFallen

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.