W3C home > Mailing lists > Public > www-forms@w3.org > October 2004

RE: Multiple select menu with default values

From: Evan Lenz <evan@evanlenz.net>
Date: Thu, 14 Oct 2004 10:25:17 -0700
To: <rob.bull@blackdog.co.uk>, <www-forms@w3.org>
Message-ID: <010801c4b212$c6462de0$6b00000a@infopop>

Hi Robert,

Thanks for your reply. But doesn't your example produce ?list_res=a%20p in
the resulting GET URL? What I want is to produce ?foo=a&foo=p, i.e. in
separate name/value pairs, rather than a single pair with space-separated
values. I want the same GET request to be produced as would be produced by
my original HTML example. I've seen how that's possible by using
<xforms:itemset> and <xforms:copy>, but I don't see how to initialize the
form with default selections as my original HTML example does.

Thanks,
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 17:25:22 GMT

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