我在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>
问题是,即使jQuery事件返回false,也会提交ajax请求!
如何在jquery验证函数之后发送请求?
我在 f:ajax
上尝试了onEvent,但似乎无法调用jQuery命名空间内的函数:
(jQuery(document).ready( function() {...)
我希望你理解我的问题 . 谢谢 .
1 回答
尝试定义您的验证函数,如下所示:
并点击使用: