cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roy huang" <lingererhu...@hotmail.com>
Subject Question and Suggessions about forms block in 2.1.6
Date Mon, 22 Nov 2004 07:03:37 GMT
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?

    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.
    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.

    WDYT?

    Roy Huang
Mime
View raw message