-
Monte96 gave this really cool example but when I try to put in form tags it tells me "selTest" is undefined. Any cures? I tried appending "Form." with out success it only told me form was undefined.I want the form tags so I can use existing forms and templets that do submits.
code:
<HTML>
<HEAD>
<TITLE>test.htm</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function selTest_onchange(){
var intloop;
var myvalue = selTest.options(selTest.selectedIndex).value;
for(intloop=1; intloop < selTest2.options.length; intloop++){
if (selTest2.options(intloop).value == myvalue) selTest2.options(intloop).selected=true;
}
}
-->
</SCRIPT>
</HEAD>
<BODY>
<Form>
<SELECT onchange="selTest_onchange()" ID="selTest" NAME="selTest">
<OPTION VALUE="1">One
<OPTION VALUE="2">Two
<OPTION VALUE="3">Three
<OPTION VALUE="4">Four
<OPTION VALUE="5">Five
</SELECT>
<SELECT ID="selTest2" NAME="selTest2">
<OPTION VALUE="1">A
<OPTION VALUE="2">B
<OPTION VALUE="3">C
<OPTION VALUE="4">D
<OPTION VALUE="5">E
</SELECT>
</Form>
</BODY>
</HTML>
-
Give your form a name, then append the name to the selTest.
-
Hi, Thanks that worked.
New Problem: I've been using this code to simulate the rows in my database so I don't have to resubmit to the Server. Works great with a dropdown, but I need a way to store and retrieve database values on a page so I can populate radio boxes based on the selected index. Again, I don't want to submit to the server
-
Best way then is to build your query, open your recordset, use the getrows method to store the contents of your recordset into an array, then write the contents of the server side array into a client side array at runtime. As the page is being generated, you can use Response.write to create client side script that stores your entire array in the page. Downside of this is the page is bigger because it has all of the data on it (in text no less). But you save roundtrips to the server and the page will be able to dynamically change form elements without refreshing.