Thanks a lot for this helpful answer.

Now I have problems with the fb:union

I have :
<fd:new id="a_class">   <!-- If I well understood what you told I shouldn't
put this here but in a fd:x -->

 <fd:class  id="a_class">
    <fd:repeater id=a_repeater>
      <fd:union  id="a_union">
       <datatype base="string">
         <fd:widgets>
           <fd: struct id="anyStruct"
           <fd:multivaluefied id="mvf">
        ...

acccording to what you wrote, I tried, in the flowscript :

var p = form.lookupWidget("a_repeater");
var newRow = p.addRow();
var f = newRow.lookupwidget("anyStruct.mvf");

thanks to prints I know that :
 -  newRow is a row of a repeater
 -  f is null (while it shouldn't).

So, what is wrong in what I had writen ?
and what is the way dealing with unions ?


thanks in advance,
Stephane




Bitte antworten an [EMAIL PROTECTED]

Gesendet von:  <[EMAIL PROTECTED]>


An:   [EMAIL PROTECTED]
Kopie:

Thema:    Re: [cforms] struct and class access in flowscript


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]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to