我在我的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