Re: checkbox from a "string" type

Chris,

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

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

-Erik

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
http://www.orbeon.com/

Received on Wednesday, 20 May 2009 21:47:23 UTC