possible if statement xforms

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

possible if statement xforms

stefan.van.de.kaa
hello,

i'm trying something and i don't know if its possible.

 <xforms:model>
            <xforms:instance id="todo-list">
                <todo-list>
                    <todo description="">
                        <task description="" done="" type="something"/>
                                                    <!--     /\     // -->
                                                    <!--     ||     // -->
                                                    <!-- this field // -->
                    </todo>
                </todo-list>
            </xforms:instance>
 </xforms:model>

if this is my model. and I want to use an option where i have my type field fore. Is it possible to show an xforms input field if the type is for example "input" and an textarea if it's "textarea"?

I have tried to use XSl into my xform but that doesn't seem to work. Maybe it's possible with an XPL but i don't know how.

Greetings,

Stefan



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: possible if statement xforms

Erik Bruchez
Administrator
Hi Stefan,

Does the @type attribute change while the form is being edited? I
guess that's what you plan to do.

If it is static, then you can generate it with XSLT upon
initialization. If it is dynamic, you cannot use XSLT when generating
the page, because that XSLT is not going to be run while the XForms
engine is in charge of the UI (note that this is a difference with the
Classic XForms engine, where things like xforms:repeat updates would
go through an entire page generation and therefore run an XSLT page
view again).

With XForms NG, you can use an xforms:switch construct to achieve
something like this.

<xforms:switch>
     <xforms:case id="show-input-case" selected="true">
         <xforms:input ref="task"/>
     </xforms:case>
     <xforms:case id="show-textarea-case">
         <xforms:textarea ref="task"/>
     </xforms:case>
</xforms:switch>

You start with selecting the case based on the initial value of the
@type attribute. Then you select a different case with the
xforms:toggle action, when the value of the @type attribute
changes. The trick is to capture the right event though: how do you
want change the value of the @type attribute?

-Erik

[hidden email] wrote:
 > hello,
 >
 > i'm trying something and i don't know if its possible.
 >
 >  <xforms:model>
 >             <xforms:instance id="todo-list">
 >                 <todo-list>
 >                     <todo description="">
 >                         <task description="" done="" type="something"/>
 >                                                     <!--     /\
// -->
 >                                                     <!--     ||
// -->
 >                                                     <!-- this field
// -->
 >                     </todo>
 >                 </todo-list>
 >             </xforms:instance>
 >  </xforms:model>
 >
 > if this is my model. and I want to use an option where i have my
 > type field fore. Is it possible to show an xforms input field if the
 > type is for example "input" and an textarea if it's "textarea"?
 >
 > I have tried to use XSl into my xform but that doesn't seem to
 > work. Maybe it's possible with an XPL but i don't know how.
 >
 > Greetings,
 >
 > Stefan



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws