Adam,
Sorry to be the bearer of bad news, but XForms 1 doesn't support XPath 2,
and the xf:case element doesn't have a condition attribute.
Ideally you should be able to do what you want simply via the @readonly MIP
in combination with CSS. However, it will depend on which processor you are
using as to how close you will get to your ideal in terms of the actual
appearance.
For example, with formsPlayer, when an input is readonly you can still edit
the contents of the control, but the change won't be committed when you
navigate away from the control--which is at least the correct behaviour,
even if it doesn't look great. (Basically, it's because readonly is
processed in the model not the view, but it's on our list of things to
improve :)
Other processors may completely lock down the control when it's readonly, in
which case it will 'feel' more like an xf:output. So if you can use the
:readonly pseudo-class to style the control so that it doesn't look like an
xf:input, then you've got pretty much what you want (without having to use
lots of switches and cases).
Regards,
Mark
Mark Birbeck
CEO
x-port.net Ltd.
e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/
Download our XForms processor from
http://www.formsPlayer.com/
> -----Original Message-----
> From: www-forms-request@w3.org
> [mailto:www-forms-request@w3.org] On Behalf Of Flinton Adam
> Sent: 07 June 2006 11:00
> To: www-forms@w3.org
> Subject: Hopefully simple question wrt case
>
>
> Dear All,
>
>
> Hopefully this is something which is one of those "so simple it hurts"
> questions.
>
> One the assumption that Xforms uses the Xpath Comparison
> Expressions as laid out at :
>
> http://www.w3.org/TR/xpath20/#doc-xpath-NodeComp
>
> I am trying something which hopefully fairly simple. I have
> tried other ways of phrasing this but find my most recent
> example below.
>
> In essence we have a requirement that once an OID is set, it
> can not be edited again. As such we have an element called
> OID_key which carries an integer which is either 0 (is set
> thus not editable) or 1 (is not yet set & thus can still be edited).
>
> What I want is for the form to evaluate OID_key & if not 0
> then allow edits (i.e. use input fields), if 0 then display
> the fields as outputs (i.e. not editable)
>
>
> Any ideas? Having been messing about, I have a strong feeling
> I am simply small string from success.
>
> TIA
>
> Adam
>
>
> <xforms:bind nodeset="OID_key" id="OID_key" type="xsd:integer" />
>
>
>
> <xforms:switch name="render">
> <xforms:case name="editable" condition="OID_key ne 0">
> <xforms:select1 ref="ISO_Root/text()"
> appearance="minimal">
> <xforms:label>ISO Root :</xforms:label>
> <xforms:hint>Where the ISO Root
> goes</xforms:hint>
> <xforms:item>
>
> <xforms:label>1.2.826.0.1285.0</xforms:label>
>
> <xforms:value>1.2.826.0.1285.0</xforms:value>
> </xforms:item>
> <xforms:item>
>
> <xforms:label>2.16.840.1.113883.2.1</xforms:label>
>
> <xforms:value>2.16.840.1.113883.2.1</xforms:value>
> </xforms:item>
> </xforms:select1>
>
> <xforms:input bind="OID_suffix"
> incremental="true" id="OIDSUFF">
> <xforms:label>OID Suffix
> :</xforms:label>
> <xforms:hint>Where the OID Suffix
> goes</xforms:hint>
> <xforms:help>Put a valid OID suffix
> here</xforms:help>
> <xforms:alert>An OID may only
> consist of numbers separated by periods (.) </xforms:alert>
> </xforms:input>
> </xforms:case>
> <xforms:case name="noteditable"
> condition="OID_key eq 0">
> <xforms:output ref="ISO_Root/text()">
> <xforms:label>ISO Root :</xforms:label>
> <xforms:hint>The ISO Root</xforms:hint>
> </xforms:output>
>
> <xforms:output bind="OID_suffix">
> <xforms:label>OID Suffix
> :</xforms:label>
> <xforms:hint>The OID
> Suffix</xforms:hint>
> </xforms:output>
>
>
>
> </xforms:case>
> </xforms:switch>
>
> This e-mail is confidential and privileged. If you are not
> the intended recipient please accept our apologies; please do
> not disclose, copy or distribute information in this e-mail
> or take any action in reliance on its contents: to do so is
> strictly prohibited and may be unlawful. Please inform us
> that this message has gone astray before deleting it. Thank
> you for your co-operation.
>
>
>
>