失去焦点后使用ajax触发JSF验证 [英] Trigger JSF validation using ajax after focus lost

查看:111
本文介绍了失去焦点后使用ajax触发JSF验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当输入组件使用ajax失去焦点而不是等待手动提交表单时,如何触发对输入组件的验证?

How do you trigger validation on an input component when the component loses focus using ajax instead of waiting for the form to be manually submitted?

推荐答案

UIInput组件中放置一个<f:ajax event="blur">,以重新呈现与该组件相关的<h:message>.

Put a <f:ajax event="blur"> in the UIInput component which re-renders a <h:message> associated with the component in question.

<h:inputText id="foo" value="#{bean.foo}" required="true">
    <f:ajax event="blur" render="fooMessage" />
</h:inputText>
<h:message id="fooMessage" />

另请参见 JSF 2.0教程Eclipse和Tomcat-视图 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆