note 26132 rejected from faq.html by nicos

From: Date: Sat, 19 Oct 2002 04:41:03 +0000
Subject: note 26132 rejected from faq.html by nicos
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38282@lists.php.net to get a copy of this message
For those who might use a HTML <INPUT> type=button instead of a type=submit, here is an example javascript function that will send a string of comma delimited codes from the selected options in a <SELECT MULTIPLE> object. The select multiple object is named "mycombobox[]" on the form. The entire form is passed to the function as "myform" in this example. function runsearch(myform){ myarray = myform.elements['mycombobox[]']; mystatestring = ','; for (i=0; i<myarray.length; i++){ if(myarray.options[i].selected == true){ mystatestring += myarray.options[i].value + ','; } } if(mystatestring==','){mystatestring='';} alert(mystatestring); //for debugging myurl = 'test21.php?formstatestring=' + mystatestring ; window.open(myurl,"","menubar=no,toolbar=no"); return; } The HTML for the button looks like this, presuming a form with a name of "mainform". <INPUT type=button value=Submit onClick="javascript:runsearch(this.document.mainform)">

« previous php.notes (#38282) next »