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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help passing form data

    Here is my problem:
    I have two select boxes, one that populates from the database, when you select an item from the first and click add, it adds it to the second select. Now, because none of them are actually selected in the second box they aren't passed on the post.

    My attempted solution:
    When someone adds or removes an item in the function I added this:
    Code:
    var selected_songs = document.getElementById("selected_songs");
    var hdn_songs = document.getElementById("hdn_selected_songs");
    for(var i = 0;i< selected_songs.length; i++)
    {
    	hdn_songs.value = hdn_songs.value + "," + album_songs.options[i].value;
    }
    Which I had hoped would happen is that when a song was added it would loop through the select box and place each value into my hidden input.

    Here is my input field and select box if it helps
    Code:
    <input type="hidden" name="hdn_selected_songs" id="hdn_selected_songs" />
    
    <select size="10" multiple="multiple" name="selected_songs[]" id="selected_songs">
    </select>
    Edit: I don't get any errors in the javascript console in Firefox, so it must be in my logic somewhere.
    Any suggestions? Let me know if I need to post additional code.

    Thanks

  • #2
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, turns out the browser wasn't reloading the js file. Once I placed the code in the header it ran like it was supposed to.


  •  

    Posting Permissions

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