The widgets have a state, you can change the state from flow:
function example ()
{
var form = new Form("definition.xml");
form.createBinding("binding.xml");
form.load(data);
var widget = form.lookupWidget("field_name");
if ( widget.value() == "" )
{
widget.setState (
Packages.org.apache.cocoon.forms.formmodel.WidgetState.OUTPUT );
}
else
{
widget.setState (
Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE );
}
form.showForm ( "template.xml");
...
The states are: INVISIBLE, OUTPUT, DISABLED and ACTIVE.
En/na Derek Hohls ha escrit:
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); 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).
Any guidance or advice appreciated.
Thanks
Derek
--
Josep A. Frau <[EMAIL PROTECTED]>
Centre de Tecnologies de la Informació
Universitat de les Illes Balears
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]