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