You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hemanth Setty <hs...@buildview.com> on 2002/08/31 18:52:42 UTC

multiple html:select boxes on the page

Hello,
I am trying to figure about a good way to use multiple select boxes with the
same data on the same page. The page contains
and bunch of questions and select box with the type of question(EASY,
MEDIUM, HARD). The question are variable and I get them from the database
along with the type for the question. The problem I am having is this, I
cannot define multiple select boxes with the same name using a DynaForm. I
could use the DynaForm.get(i) method to get a particular index of value.
But is the order of parameters coming from the page guranteed to be in the
same order as the values that were set on the selectbox?
Ex

Q1 Blah Blah?  <html:select property="type">...</html:select>

Q2 Foo bar ? <html:select property="type">...</html:select>

Before the page get displayed i will get the form and set("type", 1,
"EASY"); and set("type", 2, "MEDIUM");

When the page shows up, I assume the order will be in the right order..

Now when I click on submit on the page..will I get the Q1's type in
get("type", 1) and q2's type in get("type", 2)??

Another alternative, not very elegant though, is to have a hidden fields
associated with each select box and the value of the hidden field will have
the name of the select box. Then use the http request object to get the
value from the select box. But this way I cannot use form beans to manage
the select boxes..because the names on the selectboxes will be dynamic.

A good way that would be nice is to have the dynaformbean take something
like this
<form-property name="type" type="java.lang.String" runtime="multiple"/>
 and <html:select property="type1">...</html:select>...to <html:select
property="type5">...</html:select>.
will automatically work with get("type1")... get("type5")...etc...
Maybe im going a little overboard here...I think the DynaBean will not
support that.

So anybody enlighten me a little bit here?
Thanks in advance and have a good weekend..for those of you celebrating
Labor Day

-hemanth




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>