cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josep A. Frau" <pept...@uib.es>
Subject Re: CForms - different views of the same widget
Date Thu, 03 Nov 2005 15:49:41 GMT
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 <peptoni@uib.es>
Centre de Tecnologies de la InformaciĆ³
Universitat de les Illes Balears


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


Mime
View raw message