我使用jquery.validate插件用於檢查用戶名可用性JQuery驗證遠程錯誤
如果用戶類型sample
我需要顯示錯誤作爲
sample is available
或sample is not available
$("#form_id").validate({
rules: {
username: {
required: true
}
},
messages:{
username: {
required: "username should not be blank",
remote: $('#username_id').val()+"is already available"
}
}
});
遠程錯誤顯示
is not available
我期待
sample is not available
幫我急。
由於提前
更新時間: 我試過這個
remote: jQuery.format("{0} is already available")
一旦我點擊提交按鈕錯誤顯示爲sample is not available
,如果我再次點擊提交,並再次誤差變
server_pg.php is not available
我不知道爲什麼jque ry.validate行爲不端,像這樣...
這是行不通的,注意你得到'.val()`用於錯誤信息*當頁面加載時*而不是驗證運行時,這就是這裏的問題:) – 2011-01-07 10:39:38
我曾經使用過遠程文本元素爲遠程=「server_pg.php」。我試圖作爲你的代碼。沒有什麼適合我的 – 2011-01-07 10:41:21