How to submit form on change of dropdown list?

John picture John · Aug 29, 2011 · Viewed 641.8k times · Source

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.

Answer

BalusC picture BalusC · Aug 29, 2011

Just ask assistance of JavaScript.

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

See also: