You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joose Vettenranta <jo...@iki.fi> on 2005/06/13 10:51:14 UTC

repeater inside repeater but dynamic predefined value

Hi,

I have 2 repeaters inside each other, like this:

repeaterA {
   repeater B { ... }
}

this is how it should work:

when A is added, B is created. And B will have 1...n rows in it which 
are retrieved from the database. And there will be no possibility to 
add rows to it.

So, in db there is values {'a','b','c'} and when I add 2 new rows to 
repeaterA i have like this:

RepeaterA:row1 {
   RepeaterB:row1 {'a'}
   RepeaterB:row2 {'b'}
   RepeaterB:row3 {'c'}
}
RepeaterA:row2 {
   RepeaterB:row1 {'a'}
   RepeaterB:row2 {'b'}
   RepeaterB:row3 {'c'}
}

With every row in repeater1, I will have 2 predefined values (id and 
string) and then input-field to input some text. So it's like database 
driven form where form fields are fetch from the database.

Initial row is easy to do in flow like this:

var customFields = dao.retrieve(customTemplate);
var bean = new Parent();
var child = new Child();

child.addCustoms(customFields);
bean.addChild(child);

and that's it.

But I didn't find a way to do it in the forms.. I've been playing 
around with this stuff:

<fd:on-activate>
   <javascript>
var form = event.source.form;
var MyRepeater = form.getChild("myrepeater");
  java.lang.System.err.println("Was here!");
  </javascript>
</fd:on-activate>

But haven't found a way to add that collection to newly created bean.. 
myrepeater.addrow could be used, but how to give that Collection to the 
right field?

Thanks, Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org