cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Hermann <christoph.herm...@guschtel.de>
Subject Re: CForms - different views of the same widget
Date Fri, 11 Nov 2005 15:18:33 GMT
Derek Hohls schrieb:

Hello,

> If you look back at this thread, the idea is to have this in the
> form definition file i.e.
>  
>       <fd:on-value-changed>
>      <fd:javascript>
>        var thisWidget = event.source;
>        if ( thisWidget.getValue() == "" ) {
>          thisWidget.setState ( ACTIVE )
>        }  else  {
>         thisWidget.setState ( OUTPUT )
>        }
>       </fd:javascript>
>       </fd:on-value-changed> 
>  
> I do not think the "form.lookupWidget" approach works here...

Why not?
At least i'm able to ;-)

*hint*
var widget = event.source;
var form = widget.form;

> is there something else you can suggest?
>  
> When I try 
>  
> thisWidget.setState ( Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE )
>  
> Then I get an "unknown setState() function" error.

<fd:field id="someWidget" required="true">
...
<fd:selection-list ... dynamic="true"/>
<fd:on-value-changed>
<fd:javascript>
...
var widget = event.source;
var form = widget.form;
...
if (someCondition) {
form.lookupWidget("someOtherWidget").setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
} else {
form.lookupWidget("someOtherWidget").setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
}
</fd:javascript>
</fd:on-value-changed>
</fd:field>

HTH
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message