Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile 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

  • #2
    New Coder
    Join Date
    Oct 2008
    Location
    Australia
    Posts
    32
    Thanks
    1
    Thanked 1 Time in 1 Post
    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?)

  • #3
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    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

  • #4
    New Coder
    Join Date
    Oct 2008
    Location
    Australia
    Posts
    32
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •