I have the following piece of script near the beginning of my page.
further down I have the following scriplet.
The scriplet poplulates a combo box and what happens is
after the user selects a option from the list, the
function navcom() is executed and the name of what is selected is displayed on a blank page.
What I'm wanting to do is submit what is being displayed by the function to my database. However, when trying to figure this out, I attempted to refer to "commval" in my code immediately above and received an error instead.
As the code sits, the value being displayed is correct, but since all of the code is part of a page that will submit data to a database, this is one of the fields (the "commval"
value) that needs to be submitted as well.
How would I go about accomplishing this?
Thanks.
Code:
<script>
function navcom() {
comm=document.bookform.bcommodity.selectedIndex;
commval=document.bookform.bcommodity.options[comm].value;
document.write(commval);}
</script>
further down I have the following scriplet.
Code:
<td>Commodity:</td>
<td>
<SELECT NAME="bcommodity" onClick="navcom()">
<%
while (!rs.eof) {
val=rs("commodity_desc");
Response.Write('<OPTION value="' + val + '">');
Response.Write(val);
Response.Write("<BR>");
rs.MoveNext();
}
%>
</SELECT>
The scriplet poplulates a combo box and what happens is
after the user selects a option from the list, the
function navcom() is executed and the name of what is selected is displayed on a blank page.
What I'm wanting to do is submit what is being displayed by the function to my database. However, when trying to figure this out, I attempted to refer to "commval" in my code immediately above and received an error instead.
As the code sits, the value being displayed is correct, but since all of the code is part of a page that will submit data to a database, this is one of the fields (the "commval"
value) that needs to be submitted as well.
How would I go about accomplishing this?
Thanks.