The solution is somewhat hidden written here: http://cocoon.apache.org/2.1/userdocs/forms/widget_row_action.html.
"Where all you want to do is submit a specific row on a repeater, simply add a fd:submit element to the widgets for the repeater.
Then, you can access the submitted row either using an event handler with event.getSourceWidget().getParent(), or from the flow using form.getWidget().getSubmitWidget().getParent(). The row itself has a getWidget(widgetName) method that can be used to access specific widgets for the row."
So your form def is correct, but your flowscript not, it must read:
form.getWidget().getSubmitWidget().getParent().getWidget('imageId')Joerg
On 17.05.2004 13:46, [EMAIL PROTECTED] wrote:
Hi,
We are trying to get a repeater child value from a cocoon form. I have pasted the code for your reference.
The code works till cocoon.log.info but gives no value for imageId .
Can anyone suggest a solution.
Thanks in advance. Regards, Moin
we have the following repeater in our *-def.xml
<repeater id="images"> <widgets> <output id=" imageId "> <datatype base="string" /> </output> <output id="name"> <datatype base="string" /> </output> <field id="outputName"> <label><i18n:text>Output name</i18n:text></label> <datatype base="string" /> </field> <field id="cropInfo"> <datatype base="string" /> </field> <submit id="crop" action-command="crop" /> </widgets> </repeater>
we have the following binding code in our *-items-binding
<?xml version="1.0" encoding="utf-8"?>
<context path="/" xmlns=" <http://apache.org/cocoon/forms/1.0#binding> http://apache.org/cocoon/forms/1.0#binding">
<repeater id="images" parent-path="." row-path="."> <identity> <value id="assetID" path="metaData/image_id" /> </identity> <on-bind> <value id="assetID" path="metaData/image_id" /> <value id="name" path="metaData/image_name" /> </on-bind> </repeater>
</context>
In the flowscript .js we need to access the value of " imageId " in *-def.xml .We are trying
var form = new Form("forms/ test -def.xml");
form.createBinding("forms/ test -items-bind.xml");
var wid = form.getWidget("images");
wid.onClick = fun(wid); function fun(wid)
{ cocoon.log.info(wid. imageId .getValue()); }
The code works till cocoon.log.info but gives no value for imageId
We have also tried form.getSubmitWidget().getParent() also doesn't work.we get a message stating:
" org.apache.avalon.framework.CascadingRuntimeException: getSubmitWidget is not a function. "
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
