我在我的web应用程序中使用Jquery自动完成组合框实用工具(非常好的工具),但我想阻止表单提交,如果与自动完成组合框关联的字段为空。因此,现在,如果没有通过组合框选择任何东西,我只是不显示提交按钮,但如果已经选择了某个东西然后擦除......我不在何时(或在哪里)我已经必须隐藏我的提交按钮。防止提交,如果jQuery的自动完成组合框字段为空
任何想法?
在此先感谢。这里
编辑是我的代码:
/* HTML */
//The select filled with data for the combobox
<select id="combobox">
<option value=""></option>
<c:forEach var="item" items="${itemList}">
<option value="${item.value}">${item.key}</option>
</c:forEach>
</select>
//The form with the button
<form name="updateForm" action="update.htm" method="post">
<input type="hidden" id="id1" name="cID" />
<input type="hidden" id="id2" name="rID" />
<input type="submit" id='btn_update' value="Update" />
</form>
/* JAVASCRIPT */
//combobox widget init (...)
$("#btn_update").hide();
$("#combobox").combobox({
selected:selectedFunc
});
你可以添加你的代码:) – Awea 2012-02-21 15:42:57
我已经编辑添加我的代码。 – Tony 2012-02-21 15:55:15