通过下拉菜单选择没有提交按钮的数据库来加载记录 [英] Load records from database with dropdown selection without submit button
本文介绍了通过下拉菜单选择没有提交按钮的数据库来加载记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表单中有两个提交按钮:
I've got two submit buttons in my form:
- 提交/保存表单并将输入字段插入数据库的按钮.
- 按钮,用于基于下拉选择将记录加载到数据库中已存在的表单中.例如,更改数据库中的现有记录.
现在,我知道如何在不单击提交按钮的情况下提交表单:
Now i know how to submit a form without clicking the submit button:
onChange = "this.form.submit()"
但是我想要删除的是加载按钮",如果我在下拉列表中进行选择,它将自动加载记录,而不是使用上面的代码提交总表单.
But what i want is to remove the 'Load button' to that if i make a selection in the drop-down it automatically loads the records, instead of submitting the total form with the code above.
有什么想法要实现吗?
推荐答案
如果您使用的是jquery,则可以按如下所示的下拉更改加载数据:
If you are using jquery you can load the data on a drop-down change like so:
$('form select').change(function() {
alert('You should do your data loading now');
});
请参阅文档
这篇关于通过下拉菜单选择没有提交按钮的数据库来加载记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文