Welcome to the IBM Collaboration Solutions Community IQJam.
UsernamePassword
Reset Password | Register
   
Home | Leader Board | Tags | Help
get a handle on all the items in a repeat control 
I have a repeat control and need to loop through the items in it.  Not the type of items.  the .getchildren method appears to do that, but I actually want to loop through all of the components and get values from them.  specifically I have a repeat control bound to a vector of 30 items, the repeat control contains a checkbox control that then repeats 30 times.  I have  button, once clicked I would like to loop through the 30 checkboxes and grab the values from them.  Any thoughts on how to do this?
 
Thanks so much in advance
 
-Toby
Domino Development / XPages
Toby Samples - about 1 year ago |  |  | Viewed 373 times

There are 2 answers

1votes
Marked as correct on9/24/10 11:22 PM
I suspect you're thinking about this in slightly the wrong way. 
 
The repeat control is automatically looping over the elements in the vector for you. You can output each element of the vector by referencing the variable name the you used when creating the repeat control (the collection name). 
 
If you've got a check box being repeated then you'll need to have a read up on check box groups here: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/02102008091536PHABPL.htm and then if you want to access that value you can either bind the checkbox group to a document binding or a scoped variable in the data settings.
 
Hope this helps. 
 
Matt 


Matt White - about 1 year ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community


0votes
Hi Matt,
Thanks so much for your help.  That was kinda the answer that I was expecting to receive, but was hoping there was a magic method to pull out those com.ibm.xsp.component.xp.inputcheckbox objects for each one of the checkboxes.  From the look of it, The repeat control doesn't actually create objects for each item, it just renders html for it.  I actually found a work around yesterday that I like better than my original idea.  Basically I am not using a repeat control.  I use a panel and then then on the afterpageload event I add a com.ibm.xsp.component.xp.inputcheckbox object for each vector item to the panel control using the getCompoent('panel').getChildren().add(new com.ibm.xsp.component.xp.inputcheckbox()), that will render the items, and now they are rendered with objects.  This allows me to loop through the items using the getComponent('panel').getChildren List and get the values.  Thanks again for your help.
 
-Toby 


Toby Samples - about 1 year ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community