W3C home > Mailing lists > Public > www-forms@w3.org > May 2009

Re: checkbox from a "string" type

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 20 May 2009 14:46:38 -0700
Message-Id: <6E5C3E7E-AC84-4F58-BBEF-220AB88A2195@orbeon.com>
To: xforms <www-forms@w3.org>

Depends on your implementation.

It is reasonable for an implementation to present an xforms:input  
bound to a boolean type as a checkbox. That's what we do in Orbeon  

If that's the case, you don't even need two instances.


On May 20, 2009, at 12:01 PM, Howard, Chris wrote:

> Today's problem:
> My xml file has some "flag" elements which are ostensibly boolean.
> They can appear in my data like this:
> <flag/>   (false)
> <flag></flag>  (false)
> <flag>1</flag> (true)
> and I assume they could show up as
> <flag>true</flag>
> <flag>false</flag>
> but I haven't seen them spelled out in the data so far.
> In my Xform presentation of this I would like these elements to show
> up as a checkbox or some other user interface that won't let the users
> wander from the true/false nature of the thing.
> To get the checkbox, I'm using a small second instance
> containing just the set of flags and defining them as  
> type="xs:boolean".
> At event xforms-ready I am attempting to initialize the second  
> instance
> elements to the appropriate values.  Then when I submit I attempt
> to move that information back into the main data instance.
> My problem is that I'm having a real struggle trying to get the second
> instance elements to initialize in a reliable way.  Something
> simple like
> <xf:bind nodeset="instance('flagSet')/flag" id="flag"  
> type="xs:boolean"/>
> ...
> <xf:action ev:event="xforms-ready">
>         <xf:setvalue bind="flag" value="boolean-from-string(/top/ 
> flag)"/>
> </xf:action>
> gives me errors about an undefined function.
> Am I going about this in a reasonable way?  What should I be doing?
> Chris

Orbeon Forms - Web Forms for the Enterprise Done the Right Way
Received on Wednesday, 20 May 2009 21:47:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:16 GMT