我在JSF ajax請求和jQuery事件中遇到問題。jsf ajax在jQuery驗證功能後觸發
我使用jQuery事件來驗證組成部分是這樣的:
jQuery(".btnNextStep").live("click", function(e) {
var error = !validate(id);
...
return error;
和相同的按鈕下,我有一個Ajax事件:
<h:commandButton type="button" value="Etape suivante" class="btn btn-large btn-primary btnNextStep" id="btnFormIdentite">
<f:ajax execute="identite" render="@none" />
</h:commandButton>
的問題是,AJAX請求是submited即使jQuery事件返回false!
我可怎麼辦,這樣的要求是jQuery驗證功能後發送?
我已經試過的onEvent上f:ajax
但似乎這不是可以調用jQuery的命名空間內的函數:
(jQuery(document).ready(function() {...)
我希望你明白我的問題。 謝謝。
使用服務器端驗證。 – 757071 2013-04-05 09:15:51
另請參見:http://stackoverflow.com/questions/8416695/jsf-ajax-request-is-not-fired-when-combined-with-js-client-side-validation – 757071 2013-04-05 09:17:47