cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: CForms - different views of the same widget
Date Thu, 03 Nov 2005 15:03:00 GMT
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.

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


Mime
View raw message