Using OPS has anyone implemented a form with a control (input, output,
...) whose style changes depending on the data input? There's no shortage of real world examples, but here's one. When recording heart rate amounts over a certain threshold (say 200 bpm), might be considered 'extreme'. The value isn't considered invalid, and the user is not prevented from entering it, but it gets given a yellow background to indicate the value is outside the norm. Trying to tackle this problem declaratively, lets say I try and use a attribute on my node to calculate the css class: <xforms:bind nodeset="heartrate/@ui:class" calculate="if . gt 200 then 'extreme' else ''"/> But even with the class value now calculated & available in the instance data, there's no way that I can see to get this onto the class attribute of the control. One approach would be using the xforms-value-changed event to trigger a javascript call which sets the CSS class of the control appropriately. But AFAIK making javascript calls isn't possible in OPS. Maybe we could explore sort sort of OPS extension to achieve this linking of the xhtml:class attribute and instance data? eg <xforms:input ref="heartrate" xhtml:class="{@ui:class}" Adrian -- 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 |
Administrator
|
Hi Adrian,
Like you say, being able to use a {xpath} syntax in attributes would be an elegant solution to the problem. (This syntax is called "attribute value templates" in XSLT.) For now, you can do something like: <xforms:group ref=".[normal heart rate condition]"> <xforms:input class="normal"/> </xforms:group> <xforms:group ref=".[high heart rate condition]"> <xforms:input class="high"/> </xforms:group> The only difference between the content of the two groups will be the class used. You can use XSLT here to avoid code duplication in your code. Alex On 6/1/06, Adrian Baker <[hidden email]> wrote: > Using OPS has anyone implemented a form with a control (input, output, > ...) whose style changes depending on the data input? > > There's no shortage of real world examples, but here's one. When > recording heart rate amounts over a certain threshold (say 200 bpm), > might be considered 'extreme'. The value isn't considered invalid, and > the user is not prevented from entering it, but it gets given a yellow > background to indicate the value is outside the norm. > > Trying to tackle this problem declaratively, lets say I try and use a > attribute on my node to calculate the css class: > > <xforms:bind nodeset="heartrate/@ui:class" calculate="if . gt 200 > then 'extreme' else ''"/> > > But even with the class value now calculated & available in the instance > data, there's no way that I can see to get this onto the class attribute > of the control. One approach would be using the xforms-value-changed > event to trigger a javascript call which sets the CSS class of the > control appropriately. But AFAIK making javascript calls isn't possible > in OPS. > > Maybe we could explore sort sort of OPS extension to achieve this linking of the xhtml:class attribute and instance data? eg > > <xforms:input ref="heartrate" xhtml:class="{@ui:class}" > > Adrian > > > > > > > > > -- > 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 > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
A question regarding the use of groups in this approach - if the node in question is invalid, then is the group then obliged to display as invalid? Or is your reading of the spec that relevance is the only model property that a group should reflect? Adrian Alessandro Vernet wrote: Hi Adrian, -- 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 |
Administrator
|
Hi Adrian,
For non-relevant groups, the spec is saying: If a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. http://www.w3.org/TR/xforms/slice9.html#id148277 I don't see anything about invalid or read-only groups. In PresentationServer, we add classes around the elements in the group. If the group is non-relevant, the class xforms-disabled is added, which will hide the content of the group, in accordance with the above rule, just like we hide controls that are non-relevant. For invalid and read-only groups, we add the classes xforms-invalid and xforms-readonly on an element that goes around the content of the group. By default those classes won't do anything on a group. Do you think this is a reasonable default, of would do you see a better alternative? Alex On 6/19/06, Adrian Baker <[hidden email]> wrote: > > Hi Alex, > > A question regarding the use of groups in this approach - if the node in > question is invalid, then is the group then obliged to display as invalid? > Or is your reading of the spec that relevance is the only model property > that a group should reflect? > > Adrian > > Alessandro Vernet wrote: > Hi Adrian, > > Like you say, being able to use a {xpath} syntax in attributes would > be an elegant solution to the problem. (This syntax is called > "attribute value templates" in XSLT.) > > For now, you can do something like: > > <xforms:group ref=".[normal heart rate condition]"> > <xforms:input class="normal"/> > </xforms:group> > <xforms:group ref=".[high heart rate condition]"> > <xforms:input class="high"/> > </xforms:group> > > The only difference between the content of the two groups will be the > class used. You can use XSLT here to avoid code duplication in your > code. > > Alex > > On 6/1/06, Adrian Baker <[hidden email]> wrote: > > Using OPS has anyone implemented a form with a control (input, output, > ...) whose style changes depending on the data input? > > There's no shortage of real world examples, but here's one. When > recording heart rate amounts over a certain threshold (say 200 bpm), > might be considered 'extreme'. The value isn't considered invalid, and > the user is not prevented from entering it, but it gets given a yellow > background to indicate the value is outside the norm. > > Trying to tackle this problem declaratively, lets say I try and use a > attribute on my node to calculate the css class: > > <xforms:bind nodeset="heartrate/@ui:class" calculate="if . gt 200 > then 'extreme' else ''"/> > > But even with the class value now calculated & available in the instance > data, there's no way that I can see to get this onto the class attribute > of the control. One approach would be using the xforms-value-changed > event to trigger a javascript call which sets the CSS class of the > control appropriately. But AFAIK making javascript calls isn't possible > in OPS. > > Maybe we could explore sort sort of OPS extension to achieve this linking > of the xhtml:class attribute and instance data? eg > > <xforms:input ref="heartrate" xhtml:class="{@ui:class}" > > Adrian > > > > > > > > > -- > 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 > > > > > > > ________________________________ > > -- 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 > > > > -- > 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 > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Well I'm not sure displaying invalid groups with no feedback at all is
a reasonable default :) But it's not a serious problem - it just
occured to me that potentially there's an issue if a form author
decides (for example) they want to put a red border around invalid
groups:
.xforms-group.xforms-invalid { border:solid red 1px; } The heart rate input example below would get an unwanted red border when it was invalid. But the selector could be restricted to 'real' groups easily enough, or conversely a class added to the groups being added as workaround to ensure they're not highlighted. Adrian Alessandro Vernet wrote: Hi Adrian, -- 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 |
Administrator
|
In reply to this post by Alessandro Vernet
Also, non-relevance is inherited, as is read-only-ness. But not validity.
-Erik Alessandro Vernet wrote: > Hi Adrian, > > For non-relevant groups, the spec is saying: > > If a group is non-relevant, then the rendering approach used to > signify non-relevance is applied to the entire content of the group. > http://www.w3.org/TR/xforms/slice9.html#id148277 > > I don't see anything about invalid or read-only groups. In > PresentationServer, we add classes around the elements in the group. > If the group is non-relevant, the class xforms-disabled is added, > which will hide the content of the group, in accordance with the above > rule, just like we hide controls that are non-relevant. > > For invalid and read-only groups, we add the classes xforms-invalid > and xforms-readonly on an element that goes around the content of the > group. By default those classes won't do anything on a group. Do you > think this is a reasonable default, of would do you see a better > alternative? > > Alex > > On 6/19/06, Adrian Baker <[hidden email]> wrote: >> >> Hi Alex, >> >> A question regarding the use of groups in this approach - if the node in >> question is invalid, then is the group then obliged to display as >> invalid? >> Or is your reading of the spec that relevance is the only model property >> that a group should reflect? >> >> Adrian >> >> Alessandro Vernet wrote: >> Hi Adrian, >> >> Like you say, being able to use a {xpath} syntax in attributes would >> be an elegant solution to the problem. (This syntax is called >> "attribute value templates" in XSLT.) >> >> For now, you can do something like: >> >> <xforms:group ref=".[normal heart rate condition]"> >> <xforms:input class="normal"/> >> </xforms:group> >> <xforms:group ref=".[high heart rate condition]"> >> <xforms:input class="high"/> >> </xforms:group> >> >> The only difference between the content of the two groups will be the >> class used. You can use XSLT here to avoid code duplication in your >> code. >> >> Alex >> >> On 6/1/06, Adrian Baker <[hidden email]> wrote: >> >> Using OPS has anyone implemented a form with a control (input, output, >> ...) whose style changes depending on the data input? >> >> There's no shortage of real world examples, but here's one. When >> recording heart rate amounts over a certain threshold (say 200 bpm), >> might be considered 'extreme'. The value isn't considered invalid, and >> the user is not prevented from entering it, but it gets given a yellow >> background to indicate the value is outside the norm. >> >> Trying to tackle this problem declaratively, lets say I try and use a >> attribute on my node to calculate the css class: >> >> <xforms:bind nodeset="heartrate/@ui:class" calculate="if . gt 200 >> then 'extreme' else ''"/> >> >> But even with the class value now calculated & available in the instance >> data, there's no way that I can see to get this onto the class attribute >> of the control. One approach would be using the xforms-value-changed >> event to trigger a javascript call which sets the CSS class of the >> control appropriately. But AFAIK making javascript calls isn't possible >> in OPS. >> >> Maybe we could explore sort sort of OPS extension to achieve this >> linking >> of the xhtml:class attribute and instance data? eg >> >> <xforms:input ref="heartrate" xhtml:class="{@ui:class}" >> >> Adrian >> >> >> >> >> >> >> >> >> -- >> 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 >> >> >> >> >> >> >> ________________________________ >> >> -- 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 >> >> >> >> -- >> 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 >> >> >> > > > > ------------------------------------------------------------------------ > > > -- > 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 -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 |
Administrator
|
In reply to this post by Adrian Baker-2
Hi Adrian,
Yes, I agree, if you style invalid groups with a red border, then adding a group around an invalid input will create an unwanted border. And you give workarounds to this issue in your email. I guess it comes back to the fact that we would not need to add a group in the first place if we could use value item properties, or if we had another way to set in XForms the value of HTML attributes. Alex On 6/19/06, Adrian Baker <[hidden email]> wrote: > > Well I'm not sure displaying invalid groups with no feedback at all is a > reasonable default :) But it's not a serious problem - it just occured to me > that potentially there's an issue if a form author decides (for example) > they want to put a red border around invalid groups: > > .xforms-group.xforms-invalid { > border:solid red 1px; > } > > The heart rate input example below would get an unwanted red border when it > was invalid. But the selector could be restricted to 'real' groups easily > enough, or conversely a class added to the groups being added as workaround > to ensure they're not highlighted. > > Adrian > > Alessandro Vernet wrote: > Hi Adrian, > > For non-relevant groups, the spec is saying: > > If a group is non-relevant, then the rendering approach used to > signify non-relevance is applied to the entire content of the group. > http://www.w3.org/TR/xforms/slice9.html#id148277 > > I don't see anything about invalid or read-only groups. In > PresentationServer, we add classes around the elements in the group. > If the group is non-relevant, the class xforms-disabled is added, > which will hide the content of the group, in accordance with the above > rule, just like we hide controls that are non-relevant. > > For invalid and read-only groups, we add the classes xforms-invalid > and xforms-readonly on an element that goes around the content of the > group. By default those classes won't do anything on a group. Do you > think this is a reasonable default, of would do you see a better > alternative? > > Alex > > On 6/19/06, Adrian Baker <[hidden email]> wrote: > > > Hi Alex, > > A question regarding the use of groups in this approach - if the node in > question is invalid, then is the group then obliged to display as invalid? > Or is your reading of the spec that relevance is the only model property > that a group should reflect? > > Adrian > > Alessandro Vernet wrote: > Hi Adrian, > > Like you say, being able to use a {xpath} syntax in attributes would > be an elegant solution to the problem. (This syntax is called > "attribute value templates" in XSLT.) > > For now, you can do something like: > > <xforms:group ref=".[normal heart rate condition]"> > <xforms:input class="normal"/> > </xforms:group> > <xforms:group ref=".[high heart rate condition]"> > <xforms:input class="high"/> > </xforms:group> > > The only difference between the content of the two groups will be the > class used. You can use XSLT here to avoid code duplication in your > code. > > Alex > > On 6/1/06, Adrian Baker <[hidden email]> wrote: > > Using OPS has anyone implemented a form with a control (input, output, > ...) whose style changes depending on the data input? > > There's no shortage of real world examples, but here's one. When > recording heart rate amounts over a certain threshold (say 200 bpm), > might be considered 'extreme'. The value isn't considered invalid, and > the user is not prevented from entering it, but it gets given a yellow > background to indicate the value is outside the norm. > > Trying to tackle this problem declaratively, lets say I try and use a > attribute on my node to calculate the css class: > > <xforms:bind nodeset="heartrate/@ui:class" calculate="if . gt 200 > then 'extreme' else ''"/> > > But even with the class value now calculated & available in the instance > data, there's no way that I can see to get this onto the class attribute > of the control. One approach would be using the xforms-value-changed > event to trigger a javascript call which sets the CSS class of the > control appropriately. But AFAIK making javascript calls isn't possible > in OPS. > > Maybe we could explore sort sort of OPS extension to achieve this linking > of the xhtml:class attribute and instance data? eg > > <xforms:input ref="heartrate" xhtml:class="{@ui:class}" > > Adrian > > > > > > > > > -- > 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 > > > > > > > ________________________________ > > -- 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 > > > > -- > 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 > > > > > > > ________________________________ > > -- 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 > > > > -- > 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 > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |