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

RE: How do I get 2 values from "xforms:select1" control

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Thu, 19 May 2005 13:29:18 +0100
Message-ID: <DEE7E267-9184-486B-8E7D-740D3A4916E9@S009>
To: "'Anjali Abraham'" <anjalia@aztec.soft.net>
Cc: <w3c-forms@w3.org>, <www-forms@w3.org>
Hi Anjali,
I'm not completely sure I understand the question, but let's see. You have a
xf:select1 that is bound to some instance, and when you make a selection you
change the value of that instance data -- as normal. However, you also want
to pick up the label that came with that value, and copy that in? Is that
If so, you have three choices.
The first is to put a xf:setvalue on the xforms-value-change event of your
xf:select1. The value to be assigned is the result of doing a look-up on the
new value. If you have more than one xf:itemset and you look up values from
different sets of data in each then you will need to use the xforms-selected
event, rather than the xforms-value-changed event, since each xf:setvalue
action will be different.
The second option is to use xf:copy, and copy over a full element rather
than just a text node. This will be dependent on whether the source and
destination data are the same 'shape'.
Finally, the third option is to place the logic in the model, and use
xf:bind with @calculate. Whenever the data changes in the xf:select1, the
'look-up' will be recalculated for you.
Which solution is preferable will depend on what the data in your form
'means', and in particular whether the copying of the value is a UI task or
part of the model's logic. My personal preference would be to put it in the
model, and if the data can be changed in a number of different places in the
form (i.e., you have more than one control bound to the same data), the I
would *definitely* put the logic in the model.
Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from


From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf
Of Anjali Abraham
Sent: 19 May 2005 11:02
To: www-forms@w3.org
Cc: w3c-forms@w3.org
Subject: How do I get 2 values from "xforms:select1" control

Hi All,
            I got a bit stuck on this and I was wondering if anyone has seen
examples or knows how to get around it.
Say I've got a form with the output XML format instance data , that I'm 
planning on submitting, and some additional data to be displayed as 
output which is effectively just lookup data.
In this case I have:
      <xforms:instance id ="123" src="abc.xml"/>
            <xforms:instance id="abc">
                  <rootElement xmlns="">
                        <elements attr1="" attr2="" >
                              <element1 id=""/>
                              < element2 id=""/>
                              < element3 id=""/>
                              < element4 id=""></ element4>
I use the instance with id=123 as my input xml which will be used to fill
the data's of various controls of Xforms of a page. Now The instance with
id=abc is my output xml's format which I will be submitting it. 
My Problem is mentioned below:
Now for "element4" I need to have the value of attribute "id" as well as the
value of the element by name element4.
The control I use is:
<xforms:select1 ref="element4/@id" appearance="minimal">
      <xforms:label>Example:  </xforms:label>
      <xforms:itemset nodeset="instance('123')//ElementNames">  //input xml
is used to display this control's data
         <xforms:label ref="./name" />
         <xforms:value ref="\@id" />      //this id is stored for the
element4 - attribute id. But I need also the name 
Now how do I take the name value of whatever I had selected and need to save
that name value as the value for my output xml's element by name element4
value??????? This issue has become a work stopper for me. So Please anyone
can suggest me "How do I set the element4 value.
Received on Thursday, 19 May 2005 12:29:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:15 UTC