cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <>
Subject Re: CForms - different views of the same widget
Date Fri, 04 Nov 2005 09:14:48 GMT
Thanks guys, what you say makes sense... but my "widget"
grammer is a little limited still; would the syntax be something 
<fd:field id="key" required="true">
   var thisWidget = event.source.lookupWidget("key");
   if ( thisWidget.value() == "" ) {
     thisWidget.setState ( WidgetState.ACTIVE)
   }  else  {
    thisWidget.setState ( WidgetState.OUTPUT)

or, if not, then what (the above does not actually work;
seems thisWidget is null... but I am sure there are other
errors too...)?


>>> 2005/11/03 06:26:04 PM >>>
Jason Johnston wrote:
> Derek Hohls wrote:
> > Is it possible to set up the binding and display for a widget so that
> > it is styled differently depending on whether or not a value was set
> > for it *prior* to displaying the form?
> >
> > I would like to use this approach for a field containing a database
> > field index value - if its blank when the form is displayed, the user
> > must be able to fill it in (and *must* in fact fill it in);
> This just means that every field in the form is required="true", right?
> > but if a value
> > already exists, then the field should be displayed in "read only"
> > only mode; preferably just as a text string, [in worse case, it
> > would also be OK if the field was not displayed at all, but perhaps
> > still present in the form as a hidden field).
> You should be able to do this by extending the XSL that transforms the 
> field instances to HTML. Something like add an xsl:template that 
> matches fi:field[string-length(fi:value &gt; 0)] which then outputs 
> the value as text.
> Another possibility might be to add an fd:on-value-changed handler to 
> the fields that changes the widget state to OUTPUT when the value is 
> not empty.

That's exactly what I was about to propose: changing the widget's state 
on value change is what you're looking for!


Sylvain Wallez Anyware Technologies 
Apache Software Foundation Member Research & Technology Director

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

This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice 
CSIR Copyright, Terms and Conditions 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.

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

View raw message