Rashel Shehata wrote:
Hi,
Im having a problem setting the state of a certain child of a repeater . I have a simple repeater defined as:
...
Initially the response child is disabled but at some point i want to activate all instances of the response child in the repeater I have tried: widget.lookupWidget("../selection").getChild("response").state= Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE; but i get an error:
TypeError: Cannot set property "state" of null
i get the same error using widget.lookupWidget("../selection").lookupWidget("response"). However on trying the method, the response widget is activated for row 0(as expected): widget.lookupWidget("../selection").getWidget(0,"response").state= Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE; how do i activate all instances of the response widget in the repeater.

You can just loop over all the rows in the repeater:

var repeater = widget.lookupWidget("../selection");
for(var i=0; i<repeater.getSize(); i++) {
repeater.getWidget(i, "response").state = Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE;
}

Of course the field wouldn't be enabled by default in any new rows added, so you'd need to write extra code to do so, probably an event handler on your add-row button.

--Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to