Jason

Thanks for pointing out that I was trying to make use of 
a missing feature!

My example, because I simplified things, was a bit misleading.
What I am trying to do in the form construction, is dynamically
pass in an array of values to act as the <fd:item> elements in
a multi-field array.   If that can be done some in flowscript,
I would appreciate knowing how.  At the moment, in the form
definition, I have:

<jx:forEach var="record" varStatus="status" items="${irecords}">
  <fd:item value="${record}"><fd:label>${record}</fd:label></fd:item>
</jx:forEach>

where the "irecords" would be the array passed in from flowscript.

Could I use something like:
form.lookupWidget("records").setValue ( recordArray );

Any guidance here is appreciated.

Thanks
Derek

PS Where is the best place to find the documentation for the 
form.lookupWidget, and other form.* functions? I have been using:
http://www.jdocs.com/cocoon/2.1.9/org/apache/cocoon/forms/formmodel/Widget.html 
but its not clear from that if the setValue method can take an array?

>>> On 2008/03/03 at 05:22, in message <[EMAIL PROTECTED]>, Jason Johnston 
>>> <[EMAIL PROTECTED]> wrote:
Derek Hohls wrote:
> Working with Cocoon 2.1.8
>  
> I am trying to pass data from flowscript to a from, but
> with no success.  The value of "foo" in the scenario below
> simply does not show up (although normal widgets, which I
> have stripped out in the sample below, show up fine). 
>  
> What do I need to change?
>  
> Thanks
> Derek
>  
>  
>  
> The flowscript looks like:
>  
>    var tForm = new Form("cocoon:/db/update/form/test", {"foo":"foob"});

Unfortunately the Form constructor does not allow a second argument like 
this.  I'm pretty sure there is a feature request for this in Jira but I 
can't find it right now...

>     var tmodel = tForm.getModel();
>     tForm.showForm("db/test.uforms");
>  
> The sitemap has:
>  
>      <map:match pattern="db/update/form/*">
>        <map:generate src="update/{1}_defn.xml" type="jx">
>          <use-request-parameters>true</use-request-parameters>
>       </map:generate>
>        <map:transform src="stylesheets/forms/strip-page.xsl" >
>        <map:serialize type="xml" />
>      </map:match>         
>      
>      <map:match pattern="db/*.uforms">
>        <map:generate src="update/{1}_template.xml" 
> type="jx"></map:generate>      
>        <map:transform type="forms" >
>        <map:transform type="i18n"/>
>        <map:transform src="stylesheets/doc/cforms.xsl"/>
>        <map:serialize type="html"/>
>      </map:match> 
>  
> And the simple form (test_defn.xml) looks like:
>  
> <fd:form
>  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
>  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";
>  xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
>  
>  <fd:widgets>
>  
>   <fd:field id="message" required="false">
>    <fd:label></fd:label>
>    <fd:initial-value>* ${foo} *</fd:initial-value>
>    <fd:datatype base="string">
>    </fd:datatype>
>   </fd:field>

It looks like you just want to set the initial value of this widget 
based on a value in your flowscript?  If so, then that can easily be 
done directly by the flowscript:

var form = new Form(...);
form.lookupWidget("message").value = "foob";
form.showForm(...);


>     <fd:submit id="ok" action-command="ok" validate="true">
>         <fd:label> OK </fd:label>
>     </fd:submit>  
>     <fd:submit id="cancel" action-command="cancel" validate="false">
>         <fd:label>Cancel</fd:label>
>     </fd:submit>      
>  
>  </fd:widgets>
> </fd:form>

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



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


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

Reply via email to