2 Replies Latest reply on Apr 1, 2009 2:09 PM by Israel Fonseca

    Dinamycally from creation with a4j:repeat

    Israel Fonseca Apprentice

      Is there any problem, or special thing to know when trying to reRender a a4j:repeat component? I want to use it to dynamically create a form based from values that i receive from somewhere. Something like this:

      <a4j:form>
      
      <a4j:repeat id="iterator" value="#{managedBean.fields}" var="field"/>
      <h:inputText value="#{field.value}" rendered="#{field.type == 1}"/>
      <h:inputTextarea value="#{field.value}" rendered="#{field.type == 2}"/>
      <h:otherComponent value="#{field.value}" rendered="#{field.type == 3}"/>
      ...
      <!-- keeps going -->
      <a4j:repeat/>
      
      <a4j:commandButton value="New Form" action="#{managedBean.bringNewFields}" reRender="iterator"/>
      
      </a4j:form>
      


      Assume that my managedBean.fields is null when my page starts, and only is populated after i press the "New Form" button. The problem is when i press the button, the new "form" is not displayed. Why?

      Thjs in advance,

      Israel