faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 5 people (40%) answered Yes
Recently 2 of 5 people (40%) answered Yes

Entry

how to pass array of string values (mutiple selection box) to the server during each submission

Apr 8th, 2008 18:52
ha mo, Dave Clark, sathya vathy,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sathya,
     That happens automatically -- unless what you're really asking is 
how to pass *all* of the options in a multiple selection box to the 
server at form submission time.  That would be done as follows:
function SelectAllOptions(sel)
{
    var opt = sel.options;
    var x, len = opt.length;
    for (x=0; x<len; ++x)
        opt[x].selected = true;
    return true;
}
     This is how you tie it to your form:
<form ...etc...
 onsubmit="return SelectAllOptions(this.elements['selectName'])">
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com