开发者

Disable rerendering of input field after validation message is shown

开发者 https://www.devze.com 2023-03-13 00:31 出处:网络
Is it possible to disable rerendering of an input field after a message of failed validation is shown?

Is it possible to disable rerendering of an input field after a message of failed validation is shown?

This is a piece of my view:

<h:outputLabel for="captcha" value="#{ui.pleaseEnterTextInTheImage}"  rendered="#{sessionBean.showCaptcha}"/>
<h:panelGroup rendered="#{sessionBean.showCaptcha}">
     <h:inputText id="captcha" styleClass="captcha" validator="#{validationBean.captchaValidator}" />
     <h:outputText value=" "/><h:message for="c开发者_开发技巧aptcha" styleClass="captchaMsg"/>
</h:panelGroup>


Yes, bind the to-be-validated input component to the view and check UIInput#isValid() in the rendered condition.

<h:inputText binding="#{captcha}" required="true" />
...
<h:inputText rendered="#{captcha.valid}" />

The second will disappear upon form submit when the first has a validation error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号