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

checkbox from a "string" type

From: Howard, Chris <HowardC@prpa.org>
Date: Wed, 20 May 2009 13:01:57 -0600
Message-ID: <1305E9F69BC3CE49ABCDC8E00492F7021F2E6E@titan.internal.prpa.org>
To: <www-forms@w3.org>
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

 
Received on Wednesday, 20 May 2009 19:02:34 GMT

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