cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Question and Suggessions about forms block in 2.1.6
Date Mon, 22 Nov 2004 13:41:30 GMT
roy huang wrote:

>    in 2.1.6,Forms add widget state.I have test it yesterday and found some problems and
>    Questions:
>    In V2 flowscript,I can set widget state:
>        var name=form.lookupWidget("name");
>        name.state="disabled";
>    but in V1,I can get but set will produce an error:
>        var name=form.lookupWidget("name");
>        print(name.state);    //works here
>        name.state="disabled";    //error here.
>    The error is like can't convert disabled to Widgetstate ....
>    How can I change a widget's state in V1?

Use name.setWidgetState(WidgetState.DISABLED)

>    Suggestions:
>    I use forms block to develop a real application,some application's requirements here:
>    i)  Widgets can't be displayed under some conditions
>    ii) Widgets should be read-only under some conditions
>    In,My solutions are:
>    To i),Use jxtemplates with <jx:if> to control display the widget or not
>    To ii),a)Use jxtemplates with <jx:if> to add <fi:styling> disabled to
the widget
>          b)Use two widget,one is <fd:field> another is <fd:output>,using
<jx:if> to control display one of them.If need to edit ,display the field widget,if
need to display only ,make the field widget hidden and display the output widget(set its value
using flowscript).I can't using <fi:styling type="output"/> because this will make the
field widget's value empty after save.
>    I don't like these solutions because they all need coding in jxtemplate,mix UI and
>    2.1.6 add widget state,now has 3 state:active,disabled,invisible.It seems disabled
and invisible state can help me to make a better solutions,but here's the problem:
>    1.State disabled render a widget with disabled attribute,just like my solution ii)
a),but can't do the same effaces like ii).b).I try to modify forms-field-styling.xsl,found
if only display value,the field widget's value will be empty after save.
>    2.State invisible just make a widget can't be used,and I can't use it for i) because
if my style page using the invisible widget will produce exception like don't have this element
>    My suggestions are:
>    A)If a widget's state is invisible,let render knows it is invisible,don't delete the
widget.We can make the widget invisible by modify forms-field-styling.xsl.

No, invisible is, as its name implies, is really *not visible*.

What you describe here comes again to an additional "output" state that
I think we should add, considering the vast number of use cases where it
could be used.

>    B)To state disabled,we can keep current display method using input disabled attributed,but
the widget's value shouldn't get from the request.This allow user adjust forms-field-styling.xsl
to just display text in final page.
>    C)If B) is not a good suggestion,then make <fi:styling="output"/> just like
<fd:output> to keep it's original value or make it possible to change one widget's type
form field to output.

That's what an "output" state would allow.

How does that sound?


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message