I've run into two unexpected issues with Orbeon's policies for realizing controls for boolean-valued elements. In both cases what I view as a "reasonable" strategy for type definition essentially (I believe) confuses Orbeon into rendering elements of type xs:boolean as textboxes rather than checkboxes.
The one strategy involves defining a boolean element's value as "fixed": e.g., <!-- define a common base type for a family of definitions --> <xs:complexType name="my_base_type" abstract="true"> <xs:sequence> .... <xs:element name="some-item-1" type="xs:boolean"/> <xs:element name="some-item-2" type="xs:boolean"/> <xs:element name="some-item-3" type="xs:boolean"/> ... </xs:sequence> </xs:complexType> <!-- define a concrete realization of this base type that defaults the value of one item and fixes another --> <xs:complexType name="my_derived_type_for_my_base_type"> <xs:complexContent> <xs:restriction base="local:my_base_type"> <xs:sequence> .... <xs:element name="some-item-1" type="xs:boolean"/> <xs:element name="some-item-2" type="xs:boolean" default="false"/> <xs:element name="some-item-3" type="xs:boolean" fixed="false"/> ... </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> For instances of the derived type, Orbeon renders instances of some-item-1 and some-item-2 as checkboxes .... while rendering instances of some-item-3 as a textbox that contains the value "false". The other issue involves Orbeon's failure to treat types that are "trivially" boolean as such: e.g., <!-- define a type alias to synchronize definitions for related types. --> <xs:simpleType name="my_base_type"> <xs:restriction base="xs:boolean"/> </xs:simpleType> <!-- the following complex type is one of, say, 20 types that use my_base_type --> <!-- and I'd really prefer to have this and the other types reference the common base type, due to my immense respect for "once and only once-" (i.e., DRY-) style logic definition --> <xs:complexType name=".... whatever ..."> <xs:sequence> .... <xs:element name="some-true-or-false-value" type="local:my_base_type"/> ... </xs:sequence> </xs:complexType> For definitions such as these, XForms will realize some-true-or-false-value elements as textboxes rather than checkboxes. I know the second issue can be finessed using an XSLT application that uses a use-def analysis to replace trivial aliases for xs:boolean with xs:boolean proper; I've written it, and we're using it to preprocess our schemas for use with Orbeon. Still, it would be nice if Orbeon would provide an option for doing this analysis on a user's behalf... so long as the analysis wasn't cost-prohibitive (note: since we're using self-contained VB-style schemas, my schema hacker runs pretty quickly.) As for the "fixed" attribute issue, I don't see as obvious of fix for this problem. While it would be simple enough to write a second postprocessing application that replaces fixed="false" with default="false" in elements of type xs:boolean, that transformation really doesn't preserve the schema's semantics. Thanks for any help or advice, including pointers to dark corners of the XForms standard that I might have missed that would speak to these behaviors. Appreciatively, -- Phil =================== Phil Pfeiffer/ East TN State U. | Kindness in thought leads to wisdom. Dept. of CIS / P.O. Box 70711 | Kindness in speech leads to eloquence. Johnson City, TN. 37614-1266 | Kindness in action leads to love. [hidden email]<mailto:[hidden email]> (423) 439-5355 | -- Lao-Tsu -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Hi Phil,
The thing is that there is a fondamental issue with the way schema validation is done: when a node is invalid, the schema validator Orbeon uses doesn't tell Orbeon Forms the type of the node. So say your node is empty, the validator will find it's not a boolean, mark it as invalid and won't say that it is a xs:boolean. Which in a way is true, as empty string isn't boolean, but this prevents Orbeon Forms form rendering the control with a checkbox. We have a bug to track this, and since it would require the validator itself to be changed, unless a client sponsors this, it is unlikely to be fixed soon: https://github.com/orbeon/orbeon-forms/issues/866 So for now, in situations like this, you also need to use binds to set the type of the field. Does this explain what you are seing? Alex On Tue, Mar 5, 2013 at 11:07 PM, Pfeiffer, Phillip E., IV <[hidden email]> wrote: > I've run into two unexpected issues with Orbeon's policies for realizing controls for boolean-valued elements. In both cases what I view as a "reasonable" strategy for type definition essentially (I believe) confuses Orbeon into rendering elements of type xs:boolean as textboxes rather than checkboxes. > > > > The one strategy involves defining a boolean element's value as "fixed": e.g., > > > > <!-- define a common base type for a family of definitions --> > > <xs:complexType name="my_base_type" abstract="true"> > > <xs:sequence> > > .... > > <xs:element name="some-item-1" type="xs:boolean"/> > > <xs:element name="some-item-2" type="xs:boolean"/> > > <xs:element name="some-item-3" type="xs:boolean"/> > > ... > > </xs:sequence> > > </xs:complexType> > > > > <!-- define a concrete realization of this base type that defaults the value of one item and fixes another --> > > <xs:complexType name="my_derived_type_for_my_base_type"> > > <xs:complexContent> > > <xs:restriction base="local:my_base_type"> > > <xs:sequence> > > .... > > <xs:element name="some-item-1" type="xs:boolean"/> > > <xs:element name="some-item-2" type="xs:boolean" default="false"/> > > <xs:element name="some-item-3" type="xs:boolean" fixed="false"/> > > ... > > </xs:sequence> > > </xs:restriction> > > </xs:complexContent> > > </xs:complexType> > > > > For instances of the derived type, Orbeon renders instances of some-item-1 and some-item-2 as checkboxes .... while rendering instances of some-item-3 as a textbox that contains the value "false". > > > > The other issue involves Orbeon's failure to treat types that are "trivially" boolean as such: e.g., > > > > <!-- define a type alias to synchronize definitions for related types. --> > > <xs:simpleType name="my_base_type"> > > <xs:restriction base="xs:boolean"/> > > </xs:simpleType> > > > > <!-- the following complex type is one of, say, 20 types that use my_base_type --> > > <!-- and I'd really prefer to have this and the other types reference the common base type, > > due to my immense respect for "once and only once-" (i.e., DRY-) style logic definition --> > > <xs:complexType name=".... whatever ..."> > > <xs:sequence> > > .... > > <xs:element name="some-true-or-false-value" type="local:my_base_type"/> > > ... > > </xs:sequence> > > </xs:complexType> > > > > For definitions such as these, XForms will realize some-true-or-false-value elements as textboxes rather than checkboxes. > > > > I know the second issue can be finessed using an XSLT application that uses a use-def analysis to replace trivial aliases for xs:boolean with xs:boolean proper; I've written it, and we're using it to preprocess our schemas for use with Orbeon. Still, it would be nice if Orbeon would provide an option for doing this analysis on a user's behalf... so long as the analysis wasn't cost-prohibitive (note: since we're using self-contained VB-style schemas, my schema hacker runs pretty quickly.) > > > > As for the "fixed" attribute issue, I don't see as obvious of fix for this problem. While it would be simple enough to write a second postprocessing application that replaces fixed="false" with default="false" in elements of type xs:boolean, that transformation really doesn't preserve the schema's semantics. > > > > Thanks for any help or advice, including pointers to dark corners of the XForms standard that I might have missed that would speak to these behaviors. > > > > Appreciatively, > > > > -- Phil > > > > =================== > Phil Pfeiffer/ East TN State U. | Kindness in thought leads to wisdom. > Dept. of CIS / P.O. Box 70711 | Kindness in speech leads to eloquence. > Johnson City, TN. 37614-1266 | Kindness in action leads to love. > [hidden email]<mailto:[hidden email]> (423) 439-5355 | -- Lao-Tsu > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws > -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
=================== Phil Pfeiffer/ East TN State U. | Kindness in thought leads to wisdom. Dept. of CIS / P.O. Box 70711 | Kindness in speech leads to eloquence. Johnson City, TN. 37614-1266 | Kindness in action leads to love. [hidden email] (423) 439-5355 | -- Lao-Tsu ________________________________________ From: Alessandro Vernet [[hidden email]] Sent: Thursday, March 07, 2013 7:08 PM To: ops-users Subject: [ops-users] Re: Two concerns about realizing checkbox controls Hi Phil, The thing is that there is a fondamental issue with the way schema validation is done: when a node is invalid, the schema validator Orbeon uses doesn't tell Orbeon Forms the type of the node. So say your node is empty, the validator will find it's not a boolean, mark it as invalid and won't say that it is a xs:boolean. Which in a way is true, as empty string isn't boolean, but this prevents Orbeon Forms form rendering the control with a checkbox. We have a bug to track this, and since it would require the validator itself to be changed, unless a client sponsors this, it is unlikely to be fixed soon: https://github.com/orbeon/orbeon-forms/issues/866 So for now, in situations like this, you also need to use binds to set the type of the field. Does this explain what you are seing? Alex On Tue, Mar 5, 2013 at 11:07 PM, Pfeiffer, Phillip E., IV <[hidden email]> wrote: > I've run into two unexpected issues with Orbeon's policies for realizing controls for boolean-valued elements. In both cases what I view as a "reasonable" strategy for type definition essentially (I believe) confuses Orbeon into rendering elements of type xs:boolean as textboxes rather than checkboxes. > > > > The one strategy involves defining a boolean element's value as "fixed": e.g., > > > > <!-- define a common base type for a family of definitions --> > > <xs:complexType name="my_base_type" abstract="true"> > > <xs:sequence> > > .... > > <xs:element name="some-item-1" type="xs:boolean"/> > > <xs:element name="some-item-2" type="xs:boolean"/> > > <xs:element name="some-item-3" type="xs:boolean"/> > > ... > > </xs:sequence> > > </xs:complexType> > > > > <!-- define a concrete realization of this base type that defaults the value of one item and fixes another --> > > <xs:complexType name="my_derived_type_for_my_base_type"> > > <xs:complexContent> > > <xs:restriction base="local:my_base_type"> > > <xs:sequence> > > .... > > <xs:element name="some-item-1" type="xs:boolean"/> > > <xs:element name="some-item-2" type="xs:boolean" default="false"/> > > <xs:element name="some-item-3" type="xs:boolean" fixed="false"/> > > ... > > </xs:sequence> > > </xs:restriction> > > </xs:complexContent> > > </xs:complexType> > > > > For instances of the derived type, Orbeon renders instances of some-item-1 and some-item-2 as checkboxes .... while rendering instances of some-item-3 as a textbox that contains the value "false". > > > > The other issue involves Orbeon's failure to treat types that are "trivially" boolean as such: e.g., > > > > <!-- define a type alias to synchronize definitions for related types. --> > > <xs:simpleType name="my_base_type"> > > <xs:restriction base="xs:boolean"/> > > </xs:simpleType> > > > > <!-- the following complex type is one of, say, 20 types that use my_base_type --> > > <!-- and I'd really prefer to have this and the other types reference the common base type, > > due to my immense respect for "once and only once-" (i.e., DRY-) style logic definition --> > > <xs:complexType name=".... whatever ..."> > > <xs:sequence> > > .... > > <xs:element name="some-true-or-false-value" type="local:my_base_type"/> > > ... > > </xs:sequence> > > </xs:complexType> > > > > For definitions such as these, XForms will realize some-true-or-false-value elements as textboxes rather than checkboxes. > > > > I know the second issue can be finessed using an XSLT application that uses a use-def analysis to replace trivial aliases for xs:boolean with xs:boolean proper; I've written it, and we're using it to preprocess our schemas for use with Orbeon. Still, it would be nice if Orbeon would provide an option for doing this analysis on a user's behalf... so long as the analysis wasn't cost-prohibitive (note: since we're using self-contained VB-style schemas, my schema hacker runs pretty quickly.) > > > > As for the "fixed" attribute issue, I don't see as obvious of fix for this problem. While it would be simple enough to write a second postprocessing application that replaces fixed="false" with default="false" in elements of type xs:boolean, that transformation really doesn't preserve the schema's semantics. > > > > Thanks for any help or advice, including pointers to dark corners of the XForms standard that I might have missed that would speak to these behaviors. > > > > Appreciatively, > > > > -- Phil > > > > =================== > Phil Pfeiffer/ East TN State U. | Kindness in thought leads to wisdom. > Dept. of CIS / P.O. Box 70711 | Kindness in speech leads to eloquence. > Johnson City, TN. 37614-1266 | Kindness in action leads to love. > [hidden email]<mailto:[hidden email]> (423) 439-5355 | -- Lao-Tsu > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws > -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Hi Phil,
FYI, your response is empty, which I imagine wasn't intentional. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |