Tom Holmes Jr. wrote:
I've created numerous pages with multiple combo-dropdown boxes that
captured the label and value of a select box.
The formbean for these was always clear cut and simple.
Now, I have a select like the following:
<select name="test" multiple="true">
<option value="selection a">A</option>
<option value="selection b">B</option>
<option value="selection c">C</option>
</select>
As I understand it, when I submit, this will submit back a string array
(String[] test) which is defined in my form bean ... right?
Now lets say I have the following single select
<select name="test">
<option value="selection a">A</option>
<option value="selection b">B</option>
<option value="selection c">C</option>
</select>
<select name="test">
<option value="selection d">D</option>
<option value="selection e">E</option>
<option value="selection f">F</option>
</select>
So now there are two with the same name ... I am guessing that I will
still get back a string array (String[] test) which is defined in my
form bean ... right?
What I'd really like is a little different. I'd like the first
selection test to be test[0] = A,B, or C (since it is single select) AND
I'd like the second selection test to be test[1] = D,E, or F (since it
is single select)
Or even better yet:
I'd like the first selection test to be test["first_letter"] = A,B, or C
(since it is single select) AND
I'd like the second selection test to be test["second_letter"] = D,E, or
F (since it is single select)
So, how would I setup the form bean for this?
The way it is setup now, I have a Collection for test, and it comes back
with an argument type mismatch.
Any help would be much appreciated, and I will keep working on this.
Thanks!
You're on the right lines; you need a Map rather than a Collection if
you want key indexing. Your select's name would be test["a"] for the
first, test["b"] for the second, etc.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]