enforcing choice for input fields

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

enforcing choice for input fields

Don Smith-9
I'm trying to figure out how to enforce a strict
choice between two input fields in XForms -- that is,
you must choose one or the other, but not both (no, I
don't need a drop-down box here, I need input fields
for text).

Currently I've got this working as a XForms switch,
but that doesn't really present the user interface
that I want, because it only presents one field to
begin with and the user has to click a button to bring
up the other.

What I want is a way to present both fields initially,
but then set relevance to false if the user types
content into the other field. I've tried to accomplish
this using a bind statement that tests for text nodes,
but I can't get that to work.

Anyone have any ideas or examples to suggest?

Thanks,

Don


      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: enforcing choice for input fields

fl.schmitt(ops-users)
Don,

> What I want is a way to present both fields initially,
> but then set relevance to false if the user types
> content into the other field. I've tried to accomplish
> this using a bind statement that tests for text nodes,
> but I can't get that to work.

You could use xforms:group to display or hide controls dynamically. It
may look as follows:

<xforms:group ref=".[/text2 = '']">
     <xforms:input ref="/text1" incremental="true" />
</xforms:group>
<xforms:group ref=".[/text1 = '']">
     <xforms:input ref="/text2" incremental="true" />
</xforms:group>

If the initial instance elements text1 and text2 are empty, both
conditions are true(), so both fields are shown. As soon as the users
writes some text into /text1, the second group condition will be
false(), so the input field disappears. If the text in /text1 gets
removed, the /text2 field should reappear again.

HTH
florian




--
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
OW2 mailing lists service home page: http://www.ow2.org/wws