如何提交更改下拉列表的表单? [英] How to submit form on change of dropdown list?

查看:23
本文介绍了如何提交更改下拉列表的表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 JSP 中创建一个页面,其中有一个下拉列表,一旦用户选择了一个值,他必须单击 go 按钮,然后将该值发送到 Servlet.

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"/>

我如何使它在更改时执行它?例如.当用户选择 John 时,他的所有详细信息都会从数据库中检索并显示出来.我希望系统无需单击执行按钮即可执行此操作.

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.

推荐答案

请寻求 JavaScript 的帮助.

Just ask assistance of JavaScript.

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

另见:

  • HTML 狗 - JavaScript 教程
  • 这篇关于如何提交更改下拉列表的表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆