CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ajax and Design (http://www.codingforums.com/forumdisplay.php?f=55)
-   -   transfering data among 2 Combo boxes (http://www.codingforums.com/showthread.php?t=164906)

santhosh.v25 04-27-2009 04:42 PM

transfering data among 2 Combo boxes
 
Hi All

Could you help me out in coding JavaScript / Ajax for tranfering the data between 2 combo boxes,
let me explain this in a good way
i have 2 combo boxes assume left and right with multiple select, and 2 buttons for moving data ,one for left to right and other right to left
when i select few options from left combo and click the button all the selected should go into the right combo and at the same time those options shud be removed from left combo, i was doing this in server side but page was refreshing everytime, when i use this in clientside it was taking long time to move the data as i have 6000 options in left combo, can you help me in doing this.

thank you

stick_branch 04-28-2009 10:59 AM

i'm assuming that you have a list of items on one side, and when the user selects them and clicks "transfer" it copies the selected items over to the right side. While technically not ajax unless you send the request off to the server, this is possible.

Give each element in the list an id, and when you click on an item, run some js to note the id that has been clicked (easiest way with so many list items). When you click transfer, pull the array from the function (best done using an object) and in that array will be all the values, this bypasses having to check each item if it has been checked. Though, i'd suggest writing the items as a js script as well, because it would create a LOT more traffic. (Maybe you should think of a way to use AJAX to get around downloading so many items?)

santhosh.v25 04-28-2009 09:08 PM

thanks for the reply, i have used js for that and it got solved,
and found new requirement about auto complet for those respective combo boxes, can you give me the suggestions how can i proceed for it

thanks in advance

stick_branch 04-28-2009 10:48 PM

auto complete?

i'm presuming you mean something like google's suggest feature...

onkeyup="function()"

function()
{
test = input.value;
send an xmlhttp request off to the server and in the response, grab the results and put it in a relative box to the one that you're typing in. If you know how to do the ajax it should be relatively simple. If you need help with it give me a bell.
}


All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.