Hi joose,
I think you can do it with something like this :
********* FLOWSCRIPT
var sampleObjects = new Packages.com.Myclass(0); //I assume this has an ArrayList,
Vector or any kind of Collection instance in attribute you can
use
var sampleObjectsSize = sample-objects.getSize();
if((sampleObjectsSize > 0))
{
var data = new Object();
data.so = new Array();
data.so[0] = {value: "", label: "Choose an object"};
for( var i = 1; i < sampleObjectsSize+1; i++)
{
data.so[i] = {value: sampleObjects.getValue(i-1), label:
sampleObjects.getLabel(i-1)};
}
var form = new Form("forms/part1.xml");
form.lookupWidget("sos").setValue( sampleObjects.getValue(0));
form.showForm("part1-display-pipeline", data);
cocoon.request.setAttribute("projectSelectorForm", form.getWidget());
part2(cocoon.request.getAttribute("projectSelectorForm"));
}
else
{
cocoon.sendPage("error.html");
return;
}
/**
* notice that this piece of code is to have the string 'Choose an objec' in first
position on the table
* if your code doesn't need this and your object (bean) have getLabel and getValue you
can do :
*/
var data = new Object();
data.so = new Packages.com.Myclass(0);
var form = new Form("forms/part1.xml");
form.showForm("part1-display-pipeline", data);
,,,,
********* FORM
<fd:field id="OEMgroup" required="true">
<fd:label>1.1 OEM group :</fd:label>
<fd:datatype base="string"/>
<fd:selection-list type="flow-jxpath" list-path="so" value-path="value"
label-path="label" dynamic="true"/>
<fd:on-value-changed>
,,,,
No need to have any specific thing in the sitemap like paramaters set.
my 2 cents,
Stephane
Bitte antworten an [EMAIL PROTECTED]
An: [EMAIL PROTECTED]
Kopie:
Thema: flowscript + forms + dynamic selection list + passing information
Hi,
normally when creating selection list for forms, is done like this:
<fd:selection-list src="cocoon:/list.xml" dynamic="true" />
but now I have integer created in flowscipt and that needs to be passed
to that selection-list.
How?
Can I use request-object to pass that integer or session or something?
Small pseudo like this:
flowscript:
var i = 5;
form.showForm ("form.xml");
...
form-def.xml:
<fd:selection-list src="cocoon:/list.xml" dynamic="true" />
sitemap:
<map:match pattern="list.xml">
<map:generate type="xsp" src="list.xsp">
<map:parameter name="i" value="{value of i from flowscript}" />
</map:generate>
...
</map:match>
how this can be done?
Thanks,
Joose
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * [EMAIL PROTECTED] * +358 44 561 0270 *
---------------------------------------------------------------------
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]