cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Textor <>
Subject Re: [CForms] Getting selectedValues from a multivaluefield ?
Date Mon, 23 May 2005 16:25:32 GMT

>Please help ! I tried to find a solution in samples but the only
>multivaluefield I found was not used from flowscript. The whole form
>is just forwarded to some XSP logicsheet as a request parameter.
Maybe you cannot pass the model.userRoles directly. Keep in mind that
the flowscript form binding is designed to work from JavaScript, not
Java. I'm using a loop to feed the values to my Hibernate Object like this:

*	for*( *var* i = 0 ; i < model.rubriken.length; i++ )
		artikel.getRubriken().add(hs.load(Rubrik,*new* java.lang.Long(model.rubriken[i])));

hs is the Hibernate Session which I'm using from flowscript, but never
mind. The problem is that there is no way I'm aware of to create native
Java Arrays in flowscript (because JavaScript Arrays are really a different
type of object !) The only solution I can think of is to refactor your
createUser method to accept a Vector of objects rather than a String[],
and then do:

    model = form.getModel();
    var roles = new java.util.Vector();

    for( var i = 0 ; i < model.userRoles.length ; i ++ ) 
	roles.add( new java.lang.String( model.userRoles[i] ) ); 

    user = schaman.createUser(

Yes I know it's ugly, can somebody come up with a better solution ? Because
I've had exactly the same problem and could not come up with a better 
than the one described above. But maybe that is because CForms is designed
to be smoothly used from JavaScript, and I found the conversion between 
and Java painful at times.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message