Hi, Yes, I want to display the values of the field ddlProductFamily. It is a multi-select list field. In the application I added a new item where I selected "Value1" and "Value3" of the list field. It displays fine using $doc.display('ddlProductFamily') but I want to print the selected values below each other so I used the #foreach loop but it's always empty. I have another #foreach loop where I display attachments which works fine so I wonder what's special about the list field items.
Regards, Dennis 2016-06-24 8:59 GMT+02:00 Marius Dumitru Florea < mariusdumitru.flo...@xwiki.com>: > On Thu, Jun 23, 2016 at 5:32 PM, D R <rir....@gmail.com> wrote: > > > Hi, > > > > I am currently implementing my first XWiki application and starting to > > learn velocity. There is one thing that makes me mad. > > > > There is a static list field with code "ddlProductFamily". > > > > > > > I try to display the items in this list in a nice way (one below the > > other). > > > > It's not very clear what you want to display: > (1) the value of the ddlProductFamily field? i.e. the selected values? Does > this field have multiple selection enabled? > (2) the list of values the ddlProductFamily field can chose from? i.e. the > allowed values, what is specified in the static list definition > > In any case you should check > > http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsinapage > . And before you try to iterate something you should first display/print it > to see if it's really something that can be iterated (a list or an array). > > Hope this helps, > Marius > > > > > > Different approaches including googling didn't lead to any outcome. > > > > #foreach ($prodFam in $ddlProductFamily) > > $prodFam\\ > > #end > > > > #foreach ($prodFam in $doc.display('ddlProductFamily')) > > $prodFam\\ > > #end > > > > On the frontend it's always empty. Other #foreach loops work fine. > > > > I'm sure I just misunderstand something but I can't find the fault > myself. > > Can somebody please help me? > > > > Thanks in advance, > > Dennis > > _______________________________________________ > > users mailing list > > firstname.lastname@example.org > > http://lists.xwiki.org/mailman/listinfo/users > > > _______________________________________________ > users mailing list > email@example.com > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list firstname.lastname@example.org http://lists.xwiki.org/mailman/listinfo/users