Struts - Dynamic html:select

C

cc

Hi,
I have a problem with this HTML:SELECT:

<html:select property="beanCollectionSelect" size="10" multiple="true">
<html:eek:ptionsCollection name="testbean" property="beanCollection"/>
</html:select>



I fill up the select with this javascript:

<SCRIPT LANGUAGE="JavaScript">
function test()
{
var sel=document.forms[0].beanCollection;
var option = document.createElement("OPTION");
option.value = "1";
option.text = "new value";
sel.add(option);
}
</SCRIPT>

I execute the submit() function bad myActionForm object not contain new
element.

Is it a bug of Struts ?
Is it a bug of my program ?

Bye,
Carlo
 
W

Wendy S

<html:select property="beanCollectionSelect" size="10" multiple="true">
<html:eek:ptionsCollection name="testbean" property="beanCollection"/>
</html:select>

<SCRIPT LANGUAGE="JavaScript">
function test() {
var sel=document.forms[0].beanCollection;

The first thing I see is that your JavaScript refers to 'beanCollection' but
your select element is named 'beanCollectionSelect'. Does it work if you
make that change?

It would help to see the generated HTML. Are you getting _any_ options in
the list? What does the form bean look like?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top