2 Replies Latest reply on Aug 4, 2007 3:45 PM by Milli Coelho

    How to selectively submit a datatable in a form without vali

    Milli Coelho Newbie


      I have a form with different elements(input text, drop down etc.) with required attribute set to true. Also I have a data table(with required set to true) where users can dynamically add or remove a row. A row consists of two textinput boxes and a a4j:commandbutton(to add or delete).

      How can I let users add rows in the data table with out giving values for other required elements? Currently if they do it kicks off validation for other elements and comes back with value required. If I surround the data table with a4j:region, it does not do anything.

      here is a sample code: In this if I try to add a category before giving the email address it gives input required error. Is there a way to add categories first with out getting input required error for email address.

      <h:form id="registerform">
       <a4j:keepAlive beanName="register"/>
       <a4j:outputPanel ajaxRendered="true">
       <h:messages />
       <h:panelGrid columns="2">
       <h:outputLabel for="emailId" value="Email Address"/>
       <h:InputText id="emailId" value="#{register.emailId}" required="true"/>
       <h:outputLabel for="dataPanel" value="Categories"/>
       <h:panelGroup id="dataPanel">
       <h:dataTable var="category" value="#{register.categories}">
       <h:inputText value="#{category.name}" required="true"/>
       <a4j:commandButton action="#{register.addCategory}" image="img/plus.gif reRender="dataPanel"/>
       <a4j:commandButton action="#{register.removeCategory}" image="img/minus.gif reRender="dataPanel"/>