RE: checkbox from a "string" type

That raises two questions:

Is my input data as I described it compatible with a formal boolean
type?   (I do have some ability to change the software that
produces this data, if needed.)  It seems to me I may have a problem
with <flag/> being designated as 'false'.
 
and

How do I bind my input elements to a Boolean type so that the
Xforms implementation picks up on that information?  I do have
something in the way of an XMLSchema definition for this data.
It probably needs some work.  A simple example would help.

Speaking of implementation.  It would be really cool if there
were some kind of debugging that would dump my instance and show
the datatypes that the engine has associated with each element.
Right now the only way I know of to test such a thing is to
just throw it in the maw and see what grinds out on the user
interface presentation.  So I'm stuck with trial and error
development, again.


Chris


-----Original Message-----
From: Erik Bruchez [mailto:ebruchez@orbeon.com] 
Sent: Wednesday, May 20, 2009 3:47 PM
To: xforms
Subject: 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 22:30:49 UTC