W3C home > Mailing lists > Public > www-forms@w3.org > September 2005

Re: How to display an image depending on an intance data value

From: Swithun Crowe <swithun@swithun.servebeer.com>
Date: Tue, 20 Sep 2005 14:08:16 +0100 (BST)
To: Catherine Poinsignon <catherine.poinsignon@lombard.lu>
cc: www-forms@w3.org
Message-ID: <Pine.LNX.4.61.0509201358570.4072@meshach.swithun.servebeer.com>

Moien

You could try putting HTML for both the red and green images in their own
xf:group, and use the @ref of each group to bind to projectstatus when it
has the appropriate value.

Something like:

<xf:group ref="record/projectstatus[.='red']">
  <img src="red.gif"/>
</xf:group>
<xf:group ref="record/projectstatus[.='green']">
  <img src="green.gif"/>
</xf:group>

Depending on the value of projectstatus, one of these @refs will fail to
bind to the node, so the contents will not be visible.

Hope this helps.

Swithun.

On Tue, 20 Sep 2005, Catherine Poinsignon wrote:

> I have tried the following solution I've found on
> http://www.codeproject.com/html/fP-and-weather-ws.asp (see step 4: Rendering images)
> but it does not work. I see on the screen the text <img src="resource/images/green.gif"/>, not the image itself.
> Could someone confirm that this only works with formsPlayer ?
>
> .image
> {
>  display: block;
> }
> ...
> <xforms:output class="image" value="concat('&lt;img src=&quot;resource/images/',projectstatus,'.gif&quot;/>')">
>                 </xforms:output>
>
> I am working with Novell exteNd 5.2.1.
> Thanks again,
>
> Catherine
>
> >>> "Catherine Poinsignon" <catherine.poinsignon@lombard.lu> 20/09/2005 11:24 >>>
>
> Hi all,
>
> I have a model that looks like this :
>  <xforms:model id="model_wsrp_rewrite_" schema="resource/schema/schemadt.xsd">
>             <xforms:instance id="data_wsrp_rewrite_"
>                 nweb:pageflow-replace-data="always" nweb:primary-input-data="true">
>                 <data xmlns="">
>                     <record>
>                           ...
>                           <projectstatus>green</projectstatus>
>                           ...
>                      </record>
>                  </data>
>             </xforms:instance>
>         </xforms:model>
>
> Dependiing on the value of projectstatus, I want to display an image :
> if projectstatus = "green", the image source is "images/green.gif"
> if projectstatus = "red", the image source is "images/red.gif"
>
> How can I do that in xFroms ?
> Thanks in advance,
>
> Catherine
>
>
>
>
Received on Tuesday, 20 September 2005 13:08:13 GMT

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