PDA

View Full Version : Submitting a form to a server selected in a HTML select box dynamically


rameshbabumv
03-16-2004, 08:02 AM
Hi,

I need a small help in doing this:

I have a HTML form which has a HTML select button.

There are 4 options listed in it. All these 4 are the names of different tomcat webservers in different locations. Now the user selects any of the option and clicks submit. When the user submits, the form has to dynamically submit to the server selected in the Select box.

For example:

The first option which is "wrunner1". When I select it and submit, the form should be submitted to:
http://wrunner1:8080/run.

similarly if the second option "wrunner2" is selected and submitted. The form should submit to:
http://wrunner2:8080/run


Can we do this through Javascript.
Can any one please help.

Thanks,
Ramesh

skidooer
05-30-2004, 05:30 PM
<form action="http://wrunner1:8080/run">
<select name="action" onchange="form.setAttribute('action', this.value)">
<option value="http://wrunner1:8080/run">wrunner1</option>
<option value="http://wrunner2:8080/run">wrunner2</option>
</select>
</form>