Re: Method selectOption from Select
"Jeremy W. Redmond" <[email protected]> Tue, 30 Mar 2004 08:29:26 -0500
| Newsgroups | gmane.comp.jakarta.ecs.user |
|---|---|
| Message-ID | <OF2B95E6B3.06DEADDF-ON85256E67.0049ED46-85256E67.004A2B33@health.state.ny.us> |
try:
Option[selected].setSelected(true);
I think this is how I do it....
I usually create the Select first, then use .addElement to add each new=
option.
Something like this:
dropDown.addElement(new Option(selectField).setSelected(true));
=
=20
Jean-Francois LE =
=20
BERRE To: ecs-user@jakar=
ta.apache.org =20
<[email protected]> cc: =
=20
Subject: Method selectO=
ption from Select =20
03/29/2004 09:53 =
=20
PM =
=20
Please respond to =
=20
"ECS Users List" =
=20
=
=20
=
=20
Hi,
Method selectOption from Select seems not to work...
My code is the following:
Option[] types =3D {=00 new Option("user_auth", "user_auth",
"Utilisateur authentifi=E9"),
new Option("moderator", "moderator", "Mod=E9rateur"),
new Option("administrator", "administrator", "Administrateur")
};
int selected =3D 0;
int t =3D userToModify.getType();
if(t =3D=3D IType.USER_AUTH)
selected =3D 0;
else if(t =3D=3D IType.MODERATOR)
selected =3D 1;
else if(t =3D=3D IType.ADMINISTRATOR)
selected =3D 2;
// I checked: here t is 2 in my example
Select typesOption =3D new Select("type", types);
typesOption.selectOption(selected);
But when displaying HTML page, no item is selected in the Select form.
I checked HTML source code too...
What am I doing wrong?
I'm using this archive:
http://apache.mirror.cygnal.ca/jakarta/ecs/binaries/ecs-1.4.2.tar.gz
Thanks
Jean-Fran=E7ois
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
=