Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to submit form on change of dropdown list?

Tags:

html

jsp

I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.

            </select>             <input type="submit" name="GO" value="Go"/> 

How do I make it so that it does it on change? E.g. when the user selects John all his details are retrived from the DB and displayed. I want the system to do it without having to click the go button.

like image 463
John Avatar asked Aug 29 '11 14:08

John


People also ask

How do I add a form to a drop down in HTML?

The <select> tag is used to create a drop-down list in HTML, with the <option> tag. Used to give a name to the control which is sent to the server to be recognized and get the value. This can be used to present a scrolling list box. If set to "multiple" then allows a user to select multiple items from the menu.


1 Answers

Just ask assistance of JavaScript.

<select onchange="this.form.submit()">     ... </select> 

See also:

  • HTML dog - JavaScript tutorial
like image 83
BalusC Avatar answered Sep 19 '22 15:09

BalusC