Re: question (as if anything else would be in an email to the list...)

From: Date: Fri, 19 Jan 2001 19:58:24 +0000
Subject: Re: question (as if anything else would be in an email to the list...)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35712@lists.php.net to get a copy of this message
On Fri, 19 Jan 2001, Jason Jacobs wrote: > I tried this, but it didn't work. I need the value inside the form still > because the value of the select will be written to an array that gets passed > to the next page (as hidden inputs), which will in turn be compiled into a > value list for a db query. I tried making the name of the select be the > array posistion (value[7] in this case), but when I changed values, IE > errored and said that value.7 isn't an object. If I don't change the > option, ie, I use the default select value, the code works. But as soon as > I change the option, IE gives me an error and can't change the value. Would > this work: make the onChange event trigger a page refresh to set the form > values? Or will that simply draw the page again? Thanks. > > Here is the code I'm using...all of the php variables have values that work, > the problem is in changing the value of the select > -----BEGIN-------- > <script> > <!-- > function changeValue(newValue) { > document.addstuff.value[7].value = newValue; Whoops. Try: document.addstuff["value[7]"].value = newValue; > } > file://--> > </script> > > echo "<td colspan=\"$numfields\"> Select which location you want this to > apply to.<br><select name=\"pickloc\" > onChange=\"changeValue(this.options[this.selectedIndex].value);\">"; > > $i=0; > > while ($locidval = mysql_fetch_object($locinfo)){ > echo "<option value=\"$locidval->LocationID\">Location: > $locidval->Area</option><br>\n"; > }//end while > > echo "</td></select><input type=\"hidden\" > name=\"value[$locidnum]\"></tr><tr>\n"; > > ------END----------- > -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#35712) next »