在我使用的一个表单中,我称之为Javascript函数。虽然函数返回false,但表单被提交并且调用操作方法。基于在<h:commandbutton>中通过onclick属性调用的Javascript函数提交
我像这样使用
<h:commandButton onclick="test();" action="{#bean.menthod}">
测试 - JavaScript方法返回布尔值false。
以上不工作。下面提到的代码单独工作。我想知道为什么
<h:commandButton onclick="if(test) return true;else return false" action="{#bean.menthod}">
我想知道为什么测试结果不会返回到组件,虽然test()方法返回错误 – user3263117
,因为您在调用函数之前没有放置'return' :) –
感谢您的建议。头痛消失了,现在我可以轻松休息:) –