Single checkbox input bound to xs:boolean

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

Single checkbox input bound to xs:boolean

Larry T. Chen
Hi All,

Anybody know how to render a single checkbox bound to a xs:boolean
attribute/element?  I just want the checkbox to directly control the
true/false value of the xs:boolean attribute/element.
I've looked through all the examples and can't find any example that
does this.  I was expecting to do something like <xforms:input
ref='@my_boolean_field'/> where @my_boolean_field is bound to an
xs:boolean type.  I was expecting that it would render a checkbox, but
instead it rendered just a plain text field.  For xs:date the OPS engine
automatically creates a calendar control for it, so I was expecting
similar behavior.

Larry T. Chen
Software Engineer
Intelenet Communications, Inc.




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

Re: Single checkbox input bound to xs:boolean

Adrian Baker-2
Try using a xforms:select with a single unlabelled option together with a bind that calculates the field to be false() if it's empty. A bit of a hack but it works.

Rendering a single checkbox for boolean input isn't always desireable (some people want two radio buttons labelled Yes/No, some people want to be able to represent an optional boolean which can be left blank, which you can't do with a single checkbox). But perhaps OPS could have some sensible defaults which can be controlled with the @appearance attribute.

Adrian

Larry T. Chen wrote:
Hi All,

Anybody know how to render a single checkbox bound to a xs:boolean attribute/element?  I just want the checkbox to directly control the true/false value of the xs:boolean attribute/element.
I've looked through all the examples and can't find any example that does this.  I was expecting to do something like <xforms:input ref='@my_boolean_field'/> where @my_boolean_field is bound to an xs:boolean type.  I was expecting that it would render a checkbox, but instead it rendered just a plain text field.  For xs:date the OPS engine automatically creates a calendar control for it, so I was expecting similar behavior.

Larry T. Chen
Software Engineer
Intelenet Communications, Inc.



-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



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

Re: Single checkbox input bound to xs:boolean

Larry T. Chen
Thanks for that tip Adrian.  A <xforms:select> with a single <xforms:item> worked.

Larry T. Chen
Software Engineer
Intelenet Communications, Inc.


Adrian Baker wrote:
Try using a xforms:select with a single unlabelled option together with a bind that calculates the field to be false() if it's empty. A bit of a hack but it works.

Rendering a single checkbox for boolean input isn't always desireable (some people want two radio buttons labelled Yes/No, some people want to be able to represent an optional boolean which can be left blank, which you can't do with a single checkbox). But perhaps OPS could have some sensible defaults which can be controlled with the @appearance attribute.

Adrian

Larry T. Chen wrote:
Hi All,

Anybody know how to render a single checkbox bound to a xs:boolean attribute/element?  I just want the checkbox to directly control the true/false value of the xs:boolean attribute/element.
I've looked through all the examples and can't find any example that does this.  I was expecting to do something like <xforms:input ref='@my_boolean_field'/> where @my_boolean_field is bound to an xs:boolean type.  I was expecting that it would render a checkbox, but instead it rendered just a plain text field.  For xs:date the OPS engine automatically creates a calendar control for it, so I was expecting similar behavior.

Larry T. Chen
Software Engineer
Intelenet Communications, Inc.



-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



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