You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by DHarty <ha...@db.erau.edu> on 2001/07/12 16:34:46 UTC

html:select/options

Is there a way to dictate which "option" in a collection is set as
"selected" when the page is rendered?
ex
	<html:options collection="Roles" property="name" />

For example, I have a collection of projects that are rendered by the
<html:options> tag.  I also have  some java script which updates a project
description box when the selection is changed.  The problem is when the page
is first rendered, the two don't always match up.  I initialize the
description box to the first item in the collection, but the select doesn't
always choose the first item.

Thanks
D


html:select/options

Posted by DHarty <ha...@db.erau.edu>.
 Is there a way to dictate which "option" in a collection is initially set
as
 "selected" when the page is rendered?
 ex
 	<html:options collection="Roles" property="name" /

 For example, I have a collection of projects that are rendered by the
 <html:options tag.  I also have  some java script which updates a project
 description box when the selection is changed.  The problem is
 when the page
 is first rendered, the two don't always match up.  I initialize the
 description box to the first item in the collection, but the
 select doesn't
 always choose the first item.

 Thanks
 D



RE: html:select/options

Posted by Niall Pemberton <ni...@btInternet.com>.
Either set a value="xyz" or a name/property pointing to a bean with the
initial value on the <html:select> tag.

Niall

> -----Original Message-----
> From: DHarty [mailto:harty944@db.erau.edu]
> Sent: 12 July 2001 15:35
> To: Struts User
> Subject: html:select/options
>
>
> Is there a way to dictate which "option" in a collection is set as
> "selected" when the page is rendered?
> ex
> 	<html:options collection="Roles" property="name" />
>
> For example, I have a collection of projects that are rendered by the
> <html:options> tag.  I also have  some java script which updates a project
> description box when the selection is changed.  The problem is
> when the page
> is first rendered, the two don't always match up.  I initialize the
> description box to the first item in the collection, but the
> select doesn't
> always choose the first item.
>
> Thanks
> D
>


RE: html:select/options

Posted by Renzo Toma <re...@xs4all.nl>.
Hi,

You may want to check the docs for the html:select tag; the property="" tag
can be used to 'dictate' the current selection.
Is that what you need? If not, please describe your issue some more. Maybe
some example code helps?

Cheers,


Renzo

-----Original Message-----
From: DHarty [mailto:harty944@db.erau.edu]
Sent: donderdag 12 juli 2001 16:35
To: Struts User
Subject: html:select/options


Is there a way to dictate which "option" in a collection is set as
"selected" when the page is rendered?
ex
	<html:options collection="Roles" property="name" />

For example, I have a collection of projects that are rendered by the
<html:options> tag.  I also have  some java script which updates a project
description box when the selection is changed.  The problem is when the page
is first rendered, the two don't always match up.  I initialize the
description box to the first item in the collection, but the select doesn't
always choose the first item.

Thanks
D