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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top