cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robby Pelssers <>
Subject RE: how to set initial value in MultiValueField widjet
Date Mon, 19 Sep 2011 13:58:25 GMT
Hi Serge,

I don't think it's possible to accomplish your requirements directly in the form definition
but it should be straightforward if you do it programmatically.

Since it's a  multivalue-widget you can set the Options (values to pick from) by using   void

If you want to set the default selected values then you have to use the  void setValues<[]%29>(Object<>[]

I am not sure if have a very simple example at hand. But if you still can't get things working
programmatically...  let me know.


From: Serge Aleshin []
Sent: Monday, September 19, 2011 3:29 PM
Subject: Re: how to set initial value in MultiValueField widjet

Hello Robby!
Sorry for my English.
I mean, how to mark some values from values presented as "selected"?
For fd:field I use fd:initial-value. But I don't know how to set initial-value for fd:multivaluefield.

2011/9/19 Robby Pelssers <<>>
Hi Serge,

You can still use the 2.1.10 API for checking how cocoon forms works.

Check org.apache.cocoon.forms.formmodel.MultiValueField

Normal way is to first get hold of the widget in question using flowscript.

Then you can invoke either the
-setValue(Object value)
-setValues(Object[] values)

Some sample code for your flowscript:

var formdefinition = new Form("cocoon://pattern_pointing_to_your_formdefinition");
var formWidget  = formdefinition.form;

//now to lookup a widget you do sth like this
var mymultivaluewidget = formWidget.lookupWidget("replace_this_by_widget_id");


Hope this helps,
Robby Pelssers

-----Original Message-----
From: Сергей Алешин [<>]
Sent: Sunday, September 18, 2011 2:06 PM
Subject: how to set initial value in MultiValueField widjet

Hello everyone!
I use Cocoon 2.2.
Please tell me how to set initial value in MultiValueField widjet?
Serge Aleshin
To unsubscribe, e-mail:<>
For additional commands, e-mail:<>

Искренне ваш А.С.

View raw message