cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: form.getChild() function problem
Date Thu, 02 Aug 2007 01:01:04 GMT
Alan Menant wrote:
> Hello,
> I'm trying to get all widgets from a form with the getChildren function :
> var form = new Form(myForm.xml);
> var myWidgets = form.getChildren();
> form.showForm("myform-display-pipeline");
> But I get an error message telling getChildren() is not function 
> (form.getChild('xxx') works fine). I saw the function in Cocoon 2.1.10 
> API but I'm using Cocoon 2.2 (I got the same error with Cocoon 2.1.9).
> May this useful function have been removed ?

I think your confusion is that when you do "new Form()" from your 
flowscript, you don't get an org.apache.cocoon.forms.formmodel.Form Java 
object that has the getChildren() method, but instead you get an 
instance of the javascript class Form (see [1]) which wraps an instance 
of the Java class.

Thankfully the javascript Form object allows you to get access to the 
underlying java Form object by using the getWidget() method.  So 
changing your code to:

    var myWidgets = form.getWidget().getChildren();

...should work.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message