...

View Full Version : POSTing an entire listbox



satsujin
08-03-2008, 03:22 PM
Can someone help me here? I've got a listbox that im dynamically changing on my page (part of a form) and when I click the submit button I want to post all the contents of the listbox whether or not they're selected. Do I have to build a new variable in javascript to pass along or is there some way I can do this in PHP?

abduraooft
08-03-2008, 03:54 PM
You could use multiple="multiple" attribute with the select tag, so that users can select more than one option by clicking the Ctrl key. (http://www.webmasterworld.com/forum91/1799.htm)

With the help of javascript you can automate the "select all" procedure, see http://www.qodo.co.uk/blog/javascript-select-all-options-for-a-select-box/

satsujin
08-03-2008, 05:17 PM
I want to submit all the contents whether selected or not. Am I going to have javascript select all the contents or can i post the list box as an array regardless?

abduraooft
08-03-2008, 05:30 PM
You need to select the options (somehow) to get posted on submit.

satsujin
08-03-2008, 05:34 PM
ok thanks. there is one other thing ive just noticed. I had a working page where i could transfer options between listboxes that stopped working when i put the listboxes in a form. I was accessing the listboxes with their names using GetElementById --- do i need to change that now thier in a form?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum