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]