3
我有一個選擇框和一個輸入框,它們一起需要根據數據庫進行驗證。jQuery驗證插件:第二次嘗試後遠程調用不工作
<select name="gameID" id="gameID">
<option value="">Select</>
<option value="1>Game1</>
<option vlaue="2>Game2</>
</select>
<input type="text" name="title" id="title">
我的JavaScript驗證插件代碼片段看起來是這樣的:
title: {
required: true,
remote: function(){
return {
type:"POST",
url: "/services/my.cfc?method=checkTitleDupe",
data: "gameid="+$('#gameID').val() + "&title=" + $('[name=title]').val(),
cache: false
}
}
},
gameTitle: {required: true}
這不會對數據庫標題的檢查和它的分類。
如果我選擇Game1並輸入與數據庫匹配的標題,則會出現錯誤。
現在我回去並將gameID改爲Game2並保持標題相同。
基本上這應該是有效的。沒有被歸類爲Game2的標題。但是,驗證不會執行。看着我的螢火蟲控制檯,我沒有看到從Game1模糊和標題模糊之後的第二個Ajax調用。
任何人有任何想法我可以得到驗證再次執行?
在這個其他StackOverflow線程找到答案:http://stackoverflow.com/questions/2710548/how-do-i-use-jquery-validate-remote-validation-on-a-field-that-depends-在另一個 – Loony2nz