This discussion is archived
6 Replies Latest reply: Mar 21, 2013 12:21 AM by LillyD RSS

using af:iterator with panleformlayout.

972794 Newbie
Currently Being Moderated
Hi,
How Can I use af:iterator with af:panelformlayout? What value I have to set for the 'value' of iterator? Any example will be helpful.
  • 1. Re: using af:iterator with panleformlayout.
    user404 Pro
    Currently Being Moderated
    Yes you can.
    An example :
    http://adfpractice-fedor.blogspot.be/2011/11/working-with-afiterator-and-hashmap.html
    If you tell us where the data is coming form, we could give you a better example (if you wouldn't get it to work).
  • 2. Re: using af:iterator with panleformlayout.
    972794 Newbie
    Currently Being Moderated
    Hi,
    I have created a Entity based VO. It has two attributes. Name and Question. Based on the name I am passing I want to display all the questions in the page. I have dragged and dropped from the datacontrol as a panel form layout. But I dont want the navingation button. All the questions has to be displayed as a formlayout. So I think af:iterator can be used for this. Is this correct?
  • 3. Re: using af:iterator with panleformlayout.
    LillyD Newbie
    Currently Being Moderated
    Yes you can. We had a requirement in which we required to iterate the same form elements for a list of users. The form elements were differing based on the user type.

    We used the View Object and the Collection Model of the View object bound to the JSFF in the value.
  • 4. Re: using af:iterator with panleformlayout.
    972794 Newbie
    Currently Being Moderated
    HI,
    This is my iterator code :
    <af:iterator id="i2" value="#{bindings.Ques1.collectionModel}"
    rows="#{bindings.Ques1.rangeSize}"
    var="row">
    <af:inputText value="#{bindings.Question.inputValue}"
    label="Question :"
    required="#{bindings.Question.hints.mandatory}"
    columns="#{bindings.Question.hints.displayWidth}"
    maximumLength="#{bindings.Question.hints.precision}"
    shortDesc="#{bindings.Question.hints.tooltip}" id="it3"
    autoSubmit="true" immediate="true" rendered="true"
    binding="#{pageFlowScope.DomainPwdMgmtBean.question}">
    <f:validator binding="#{bindings.Question.validator}"/>
    </af:inputText>
    </af:iterator>


    This is not working. It is giving me output something like this :

    Question : What is your first name?
    Question : What is your first name?
    Question : what is your first name?

    But what is want is :
    Question : What is your first name?
    Question : Who is your first teacher?
    Question : Which your Favorite food?

    Any help?
  • 5. Re: using af:iterator with panleformlayout.
    990835 Newbie
    Currently Being Moderated
    1) Create a view criteria for name = :bindName in your VO.
    2) Create a method in AMImpl file for setting the bind parameter :

    public void(String Name)
    {
    vo.setApplyViewCriteriaName("NameVOCriteria");
    vo.setbindname(name);
    vo.executeQuery();
    }

    3) Execute the method in page binding of the page passing the name
    4) <af:panelFormLayout id="pfl7" >
    <af:forEach items="#{bindings.VOIterator.rangeSet}" var="row">
    <af:outputText label="#{row.DisplayName}" id="it9" value="#{row.DisplayValue}" shortDesc="#{row.HelpText}"
    readOnly="true" />

    </af:forEach>
    </af:panelFormLayout>

    Hope this helps.

    /A
  • 6. Re: using af:iterator with panleformlayout.
    LillyD Newbie
    Currently Being Moderated
    Hi,

    Just to reply to your thread. Changed the code to some extent. Kindly try and if let me know if it works

    <af:iterator id="i2" value="#{bindings.Ques1.collectionModel}"
    rows="#{bindings.Ques1.rangeSize}"
    varStatus="vs"
    var="row">
    <af:inputText value="#{row.Question}"
    label="Question :"
    required="#{row.Question.mandatory}"
    columns="#{row.Question.hints.displayWidth}"
    maximumLength="#{row.Question.hints.precision}"
    shortDesc="#{row.Question.hints.tooltip}"
    id="it3"
    autoSubmit="true" immediate="true" rendered="true"
    binding="#{pageFlowScope.DomainPwdMgmtBean.question}">
    <f:validator binding="#{row.Question.validator}"/>
    </af:inputText>
    </af:iterator>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points