• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in getting selected values from multiselect list

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have two multiselect listboxes in my page. In List1 the data will be retrieved from DB and listed.I will have buttons to move the values from List1 to List2 and viceversa.

After selecting the needed values,I can rearrange them in List2 using some buttons. I have coded this moving and reordering using javascript.

What happens is while submitting the page I want the values from list2 which are rearranged. But im getting the order in which I moved from list1 to list2.

I am using html:selectfor both lists

List1
------
<html:select name="CustForm" property="custName" multiple="true" size="10">
<html ptionsCollection property="CustomerNames" value="custName" label="id"/>
</html:select>


I am having a customer form which has a arraylist CustomerNames. This arraylist has customer bean which has proeprties custName and id. The custForm also has a String custName.


List2
------
<html:select name="CustForm" property="selectedCustName" multiple="true" size="10">
<html ption value=""/>
</html:select>

The custForm also has a String[] selectedCustNames from where I get the selected values in list2


Please let me know what am I doing wrong here.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've used a similar technique in letting users select values, but I have not had this problem. The only thing I might suggest is to make sure that your javascript causes all the options to be selected before submitting the form, as only selected values will be submitted. If you're already doing that, try unselecting all of them, then re-selecting them in the proper order.

Here is the function that I use to select all options:

 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah I have did this to select all the values from list2.

Actually while moving items up and down in list 2,in the script,I have swapped the text but didnt exchange the values. That was the problem and its fixed now.

Thanks a lot !!
 
reply
    Bookmark Topic Watch Topic
  • New Topic