You need to submit the changes in the field contents to the server. I
presume when you talk about the form being 'refreshed' you actually mean
that it POSTs to some action which does some stuff and then you get
forwarded back to the same jsp again?

The web browser will only submit the values for the _selected_ items in the
respective <select> fields. As far as the browser is concerned there are two
seperate select fields, and the values that are selected are only the ones
that are highlighted! (We know of course that its conceptually one field
with one box being unselected stuff and the other box the selected stuff,
but the browser isnt so smart)

What you need therefore is to ensure that the values are selected
(highlighted) at submit time.
This will involve some fancy javascript coding to go and set the 'selected'
property on all the option elements in both boxes when the form is
submitted.

(Before going ahead and spending time writing javascript to do this you will
probably want to confirm that this actually is the issue by manually
highlighting all the values in both boxes in your page, and invoking the
submit. See how it gets handled and what gets submitted in the request)

<snip>
I HAVE DECLARED 2 STRINGS FOR THESE 2 SELECT BOXES
</snip>

Surely you mean a string array ( String[] ) for each of the 2 fields as they
will both be submitting multiple values?

-----Original Message-----
From: Mathew, Manoj [mailto:[EMAIL PROTECTED]
Sent: Thursday, 4 September 2003 21:43
To: Struts Users Mailing List
Subject: issue with the multi select


Hi all

  I have 2 multi select box( wth size 5)  and have  "ADD" and :remove"
button in a dyna action form. Basically you can select one or more from a
select box and add it to the second one using ADD buton adn remove the
selected using "REMOVE" button. I have some other actions also in the same
page.

issue:

   Add and REmove are working(in java script). but when he entire form is
refreched( when some other actions are executed), the select box is not
retaining the value.So basically "ADD" and"REMOVE" is not updating the form
values. I checked the valuew of the select boxes when the form is posted.
The values are not correct. ie it is not retaing my "ADD" and "REMOVE"
values..

IN STRUCTS_CONFIG, I HAVE DECLARED 2 STRINGS FOR THESE 2 SELECT BOXES

ADD
function add(value,to)
{ 
        var newoption= new Option(value,value);
        document.forms[0].s2.options[document.forms[0].s2.length]=newoption;
                
}
function remove(from) { 
        for (var i=(from.options.length-1); i>=0; i--) { 
                var o=from.options[i]; 
                if (o.selected) { 
                        from.options[i] = null; 
                       
                        } 
                } 
        from.selectedIndex = -1; 
        } 

thank you
manoj

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to