Hello All:
I would first of all like to
thanks Robert for answering my posting.
I really appreciate it. However, if
there is any source code that may help
me I would really appreciate it.
However, I would like to add something to
the beginning of the select list, since I
want to be able to change the first item
dynamically. I was using htmlKona from weblogic
before and I used to be able to do the following,
"addHeadMultiElement(optionElement);"
In addition, Is there a way that I can
get the text and value of an option element
for a select object.
For example in htmlKona I used to be able to:
(Basically I am trying to translate the
following method to use ECS but I have
had no luck. As you can see, I want to create
copies of previously created dropdowns.
I am placing ? next to the lines which
I would like to know how to translate to ECS.)
private synchronized Select cloneDropdown(String name) throws Exception
{
Select dd = (Select) dropdownMap.get(name);
Select new_dd = new Select(name);
for (int i = 0; i < dd.getNumElements(); i++)
{
OptionElement new_oe = new OptionElement();
new_oe.setText(dd.getElementAt(i).getText());????
new_oe.setValue(dd.getElementAt(i).getValue());????
new_dd.addElement(new_oe);
}
return new_dd;
}
Thanks in advance....
Alex Restrepo
-----Original Message-----
From: Robert Burrell Donkin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 4:18 PM
To: [EMAIL PROTECTED]
Subject: Re: Adding element to the begiining of an selection list and
selecting an element by index
"RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:
> Hello All:
hi!
i had a little think about answering your questions exactly but decided
against it ;-)
these are the easy ways to do what you want rather than answers to your
specific questions. i will post code examples for you to do these things
if that's what you really need - just post to the list.
(in particular i've been playing about with select options recently and
came to the conclusion that multithreading issues would usually mean
that it's probably best to generate new every time rather than cache. i
don't what other people think about this)
> I am new to ECS and I had a couple of questions:
>
> 1) Once I create a Select object how can I add
> an element so it is the first 1 in the selection list.
> For example, I want to create a Select object
> and then add the selection - "Please select 1 city"
> to the beginning of the selecton list instead of being
> added to the end of the list.
elements are added in order. the easy way is select.addElement("Please
select 1 city") before you add your
options.
eg.
new org.apache.ecs.html.Select("name").addElement("Please select 1
city")
then add your options
> 2) Also how can I programatically get a reference to
> a Option element in a list by index and then select
> that element?
> For example, I want to select the 3rd element in a list
> so how do I get the 3rd Option Element Object and
> set the attribute of the option element to SELECTED.
the easy way is to .setSelected(true) on the 3rd option when you create
it.
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
RE: Adding element to the begiining of an selection list and selecting an element by index
RESTREPO, ALEXANDER G [Non-Pharmacia/1000] Wed, 28 Feb 2001 14:22:18 -0800
- Re: Adding element to the begii... RESTREPO, ALEXANDER G [Non-Pharmacia/1000]
- Re: Adding element to the ... Robert Burrell Donkin
