seam - Check for validation errors in part of a form in JSF -


i'm building seam application, huge form divided different parts, or modules. need way figure out when module "complete", meaning validation fields in module passes. need in view, setting css-class or whatever.

something like:

<a:region id="region1">     <s:div styleclass="#{invalid ? 'errors' : ''}">        <h:inputtext required="true" id="input1" />        <h:inputtext required="true" id="input2" />        <h:commandbutton value="save section" rerender="region1" />     </s:div> </a:region> 

i figured had 2 options:

  • using sort of view-logic (like #{invalid} single field)
  • using method in bean, components module programmatically, , check them validation errors.

however, can't find way of them. ideas if possible?

we're using jsf 1.2 seam.

thanks.

you can use uiinput#isvalid() check if validation error has occurred on particular input component.

<s:div styleclass="#{!input1.valid or !input2.valid ? 'errors' : ''}">    <h:inputtext binding="#{input1}" required="true" id="input1" />    <h:inputtext binding="#{input2}" required="true" id="input2" />    <h:commandbutton value="save section" rerender="region1" /> </s:div> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -