struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Miller <tmil...@kdsi.net>
Subject Re: Multiple list box selected items passed in to bean setter method...
Date Tue, 10 Oct 2000 12:54:29 GMT
Hello Kevin

I'm doing exactly the same thing (a "two" list-box selection setup), have
exactly the same questions, and am hoping Craig has time for an answer.

I've worked around the problem you describe by concatenating my own delimited
list of selected options using JavaScript in an onSubmit function, which I then
place in selector.options[0].value. Over in the form bean setter for the second
list-box input variable, I unpack it and place the collection in another
variable, which the upstream classes can use. Also in that onSubmit function I
set all of the selector.options[...].selected = true. I suppose it would only
take one, but without that, the form bean setter never gets called.

Hopefully there is more than meets the eye in the way Struts handles this which
we can learn from Craig. or perhaps an upcoming version can fill in this
functionality.

Tom Miller

"Duffey, Kevin" wrote:

> Hi,
>
> Craig (and all), I asked this before and I am not sure what is going on now.
> I created a "two" list-box selection setup, where on the left is a list of
> items, and on the right is an empty box. In the middle is a -> and a <- that
> when clicked moves items from the left to the right, or vice versa. I see
> this work on another site and I added it to ours. The actual movement of
> items is fine (using JavaScript), and the reson for it is so a user doesn't
> have to try to use the CTRL key while selecting many items in a list that
> may need to be scrolled. Its a pain in the ass to do this. Furthermore, we
> use this same list to allow "modifying" the selected items, and you can
> imagine that if the previously selected items are redisplayed selected, you
> have to select them all over again, PLUS the new ones you want. So, my
> dual-box selection works nicely. However, one problem is happening.
>
> When i move items from the left to the right, they show up fine. If I view
> source..the source doesn't show any extra <option value=".."> tags for the
> right-side box. I am not sure if this is to be expected..but I would think
> that MSIE/Netscape does not update the source in real-time. But, when I
> submit the form, for some reason the only values showing up are the ones
> that were there when I generated the page. In the bean being populated by
> Struts, I have a setXXX(String value). I thought (at least with Orion) that
> multiple items are passed in as , separated items. I think you told me to
> use a String[] instead. I did this and now the page being displayed says
> Argument type mismatch in BeanUtils.populate(java:350). I commented out the
> String version, and only have the String[] setter method. I had both as
> well. If I use the String version with the String[] commented out, it
> works..but only one value seems to be coming in.
>
> So if you could shed some light..that would be great.
>
> Thanks.


Mime
View raw message