[thelist] Another Netscape problem
dave gray
dascott at wam.umd.edu
Tue Aug 22 15:09:59 CDT 2000
On Tue, 22 Aug 2000, Jagjeet Hayer wrote:
> Ok, here goes. The select box is dynamically populated from a servlet. I
> then need to retrieve one of these values depending on what the user selects
> from another select box which is displayed on the screen.
so would the code to generate the select box look like:
<select name=select1>
<!-- insert server-parsed code here -->
</select>
?
> So I want the first select box to be hidden because it is there purely as a
> data element.
i don't understand why you have to use that hidden select box to store
your data... i think things would be a lot easier for you if you used a
javascript array as your data element, like so:
<input type=hidden name=select1 value="default">
<select name=select2
onchange="makeItSo(this.selectedIndex);">
<option value="whatever" selected>
</select>
<script language="javascript" type="text/javascript">
<!--
// i don't know if this would actually work to have an array
// declaration split up like this over several lines...
var optionArray = ('<!-- insert server-parsed code here -->',
'<!-- insert server-parsed code here -->');
function makeItSo(val) {
document.forms[0].select1.value=optionArray[val];
}
makeItSo(document.forms[0].selected2.selectedIndex);
// -->
</script>
so that you pull the values out of the servlet and put them into a
javascript array which you grab them back out of when your visible select
box is changed
if you have any more questions, feel free to ask, or if i'm not
understanding your problem, let me know that too :)
HTH
-dave
More information about the thelist
mailing list