On Wed, Aug 11, 2004 at 01:32:35PM +0200, Stephane Delort wrote:
<snip/>
> I would like to fill it with values from a bean, in a flowcsript so I did ;
>
> var model = form.getModel();
> var p = form.lookupWidget("widgetClass");
> var f = p.lookupWidgetWidget("union").getChild("simpleList").lookupWidget
> ("list"); /* error here because p is null*/
> f.setSelectionList( c, "listId", "label" );
>
> but then I have a "cannot convert nul to a n object" error (p is null)
> I took a look at the cocooon API but I really don't know how to deal with
> class, union, ans struct in flowscript (or java).
>
> any help greatly appreciated,
> Stephane
I don't have time to describe all of it right now, but this might
help get you started...
<fd:widgets>
<fd:class id="someClass">
<fd:widgets>
<fd:field id="myField">
<!-- fill in widget details here -->
</fd:field>
</fd:widgets>
</fd:class>
<fd:struct id="spacer">
<fd:new id="someClass"/>
</fd:struct>
<fd:widgets>
A "fd:class" is not a real widget...it is just a blueprint for
creating widgets. So you need to put an "fd:new" where you want
to build an instance of the widgets described by this blueprint.
Note in the sample above that I wrapped the "fd:new" with an
"fd:struct"...this is because the "fd:class" and the "fb:new"
must be in different "namespaces" since they use the same id.
You could instead wrap the "fd:new" in a repeater or a union...
anything that would put it in a different namespace.
To access "myField" from flowscript or java, you would use
lookupWidget to reference "spacer.myField"...note that neither
the "fd:class" nor the "fd:new" are referenced.
--Tim Larson
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]