cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 黄 海冬 <lingererhu...@hotmail.com>
Subject Re: Question and Suggessions about forms block in 2.1.6
Date Mon, 22 Nov 2004 16:26:37 GMT
    Using output state did solve my problem ii),if we can access/change 
widget's value through flowscript.But if invisible state just make widget 
*not visible*,the UI shouldn't throw exception .Under this condition user 
must encode in flowscript and jxTemplate to make invisible state work,it 
alse break the rule of seperate diplay and logic.
    WDYT?
    
    Roy Huang
>From: Sylvain Wallez <sylvain@apache.org>
>Reply-To: dev@cocoon.apache.org
>To: dev@cocoon.apache.org
>Subject: Re: Question and Suggessions about forms block in 2.1.6
>Date: Mon, 22 Nov 2004 14:41:30 +0100
>
>roy huang wrote:
>
> >Hi,all:
> >    in 2.1.6,Forms add widget state.I have test it yesterday and found 
some problems and questions.
> >    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)
Thank you!
>
> >    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 2.1.5.1,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 logic.
> >
> >    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
>
>--
>Sylvain Wallez                                  Anyware Technologies
>http://www.apache.org/~sylvain           http://www.anyware-tech.com
>{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
>

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  


Mime
View raw message