RE: Multiple select menu with default values

Evan,

Try binding the xForms:Select to a single node, then give the single node in
the initial instance a space separated list of your default values, you
should achieve this.

eg

        <xforms:select ref="//root/list_res" >
           <xforms:itemset model="test" nodeset="//root/set/node">
              <xforms:label ref="@val1"/>
              <xforms:value ref="@val2"/>
           </xforms:itemset>
        </xforms:select>

then in the instance:

	<root>
		<set>
			<node val1="apples" val2="a">
			<node val1="bannanas" val2="b">
			<node val1="pears" val2="p">
		</set>
		<list_res>a p</list_res>
	</root>

your select should be rendered with the apples bannanas and pears as the
list items, with apples and pears initially selected. Cnange the selectio to
bannanas and the submitted xml will contain
"<list_res>p</list_res>".

Note the restriction that the value cannot contain spaces.

Hope this helps.

Regards

Rob

****************************************************
*  This e-mail is for the intended recipient only, *
*  its contents and the content of any attachments *
*  is copyright material belonging to HoT Training *
*  and Consultancy Ltd, and all information herein *
*  should be treated as Company Confidential       *
****************************************************

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org]On
Behalf Of Evan Lenz
Sent: 13 October 2004 23:41
To: www-forms@w3.org
Subject: Multiple select menu with default values



Is there an XForms equivalent to the HTML below that would submit the same
GET request as an HTML browser would (with separate name/value pairs as in
f=opt1&f=opt3)?

<select name="f" multiple>
  <option value="opt1" selected>Option 1</option>
  <option value="opt2">Option 2</option>
  <option value="opt3" selected>Option 3</option>
  <option value="opt4">Option 4</option>
</select>

I might not be looking in the right places, but so far it doesn't look like
this is possible. (I see how <itemset> could be used to bind to multiple <f>
elements, but I don't see how to specify default values in that case.) If
someone could prove me wrong, that would be nice.

Thanks,
Evan

Received on Thursday, 14 October 2004 08:11:36 UTC