9 Replies Latest reply on May 11, 2012 9:52 AM by linton chao

    cc.attrs.invalid is evaluated as true even if input field is valid

    Milan Pevec Newbie

      I have a problem using composite inputContainer (JSF2, Glassfish 3.1.1, SEAM3 Faces). In my view, i have:


      <h:form id="f1">    
                  
        <sc:inputContainer  label="Temp1">
          <h:inputText required="true" value="#{customerPresenter.temp1}" />
        </sc:inputContainer>
        
        <sc:inputContainer  label="Temp2">
          <h:inputText required="true" value="#{customerPresenter.temp2}" />
        </sc:inputContainer>
                                               
        <div class="formbuttons">
           <h:commandButton value="temp" action="#{customerPresenter.register()}">
           </h:commandButton>            
        </div> 
                     
      </h:form>



      where my InputContainer code have a following lines:


      <cc:interface componentType="org.jboss.seam.faces.InputContainer">
         <cc:attribute name="label" required="true"/>
         <cc:attribute name="required" required="false"/>
         <cc:attribute name="ajax" required="false" default="false"/>
         <cc:attribute name="inputs" required="false" default="1"/>   
      </cc:interface>
      
      <cc:implementation>
          
         <div class="formdiv" id="#{cc.clientId}">
              <h:outputLabel id="label" for="" value="#{cc.attrs.label}:" styleClass="#{cc.attrs.invalid ? 'label errors' : 'label'}">
                  <h:panelGroup styleClass="required" rendered="#{cc.attrs.required}">*</h:panelGroup>
               </h:outputLabel>
               <span class="#{cc.attrs.invalid ? 'input errors' : 'input'}">
                   <h:panelGroup>
                     <cc:insertChildren/>
                   </h:panelGroup>
               </span>
               <h:panelGroup rendered="#{cc.attrs.invalid}">
                  <c:forEach var="i" begin="1" end="#{cc.attrs.inputs}">              
                     <h:message id="message#{i}" for="" styleClass="error errors"/>
                  </c:forEach>
               </h:panelGroup>
         </div>    
      </cc:implementation>





      First of all I leave my form empty and press button - a validation error appears, as expected, then i populate fields and press button again. An action method is called, but cc.attrs.invalid is still evaluated as true, so my form looks like i have a validation error, but my data is valid. I really need help, iam stucked.. thnx for reply.