You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mo...@wipro.com on 2004/05/17 13:46:58 UTC

Cocoon form - repeater child value - org.apache.avalon.framework.CascadingRuntimeException: getSubmitWidget is not a function.

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. "





Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: Cocoon form - repeater child value - org.apache.avalon.framework.CascadingRuntimeException: getSubmitWidget is not a function.

Posted by Joerg Heinicke <jo...@gmx.de>.
The reason that wid.imageId.getValue() does not work is the missing row 
number in it. You can not access the widget imageId from the repeater 
directly as it is not know from which row you want that widget.

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, moinuddin.ahmed@wipro.com 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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org