Disable rerendering of input field after validation message 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.
精彩评论