5 Replies Latest reply on Sep 26, 2011 4:28 AM by hantsy bai

    InputContainter added required mark for all fields.

    hantsy bai Master

      I only set required on some fields, but it added a star to every fields. Where is wrong?



      <p:input id="shortName" label="#{messages['Addressee.ShortName']}">
                                                              <h:inputText id="input"
                                                                      value="#{addresseeEdit.currentAddressee.shortname}"
                                                                      style="width:200px">
      
                                                              </h:inputText>
                                                      </p:input>
                                                      <p:input id="fullName" label="#{messages['Addressee.FullName']}" required="true">
                                                              <h:inputText id="input"
                                                                      value="#{addresseeEdit.currentAddressee.fullname}"
                                                                      style="width:200px" required="true">
                                                              </h:inputText>
                                                      </p:input>
                                                      <p:input id="address" label="#{messages['Addressee.Address']}">
                                                              <h:inputText id="input"
                                                                      value="#{addresseeEdit.currentAddressee.address}"
                                                                      style="width:200px">
                                                              </h:inputText>
                                                      </p:input>
      



      The input composite component is from the booking example.



      
         <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="entry" 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'}">
                  <cc:insertChildren/>
               </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>