ScottInTexas
07-12-2003, 04:37 PM
This really has two parts, ASP and Javascript. I have retireved the names of the tables in a database and I want to set the value of a hidden field on a form with one of the names and then submit the form to an asp that opens the table and displays the fields and values.
My ASP builds a menu of tbalnames and inserts the onClick during the contruction. The form is predefined with a hidden field on the page. On click should assign a value to the hidden field and then post the form. Here's the code.
javascript function
function GetTable(which){
var thiselement=document.getElementById("tblnam");
alert(thiselement.value); /* This shows me */
thiselement.value=which.innerText;
document.all.tbltree.submit;
}
This is the resulting page after the previous function.
<form id="tbltree" action="GetData.asp" method="Post">
<Div id="DBStruct" >
<table id="tblList"><input type="hidden" id="tblnam" value="me" />
<tr><td class="tblName" onClick="GetTable(this)">
etc, etc.
I thought that by assigning a value to the input and then calling the submit method the form would post. Is there a way to do this?
My ASP builds a menu of tbalnames and inserts the onClick during the contruction. The form is predefined with a hidden field on the page. On click should assign a value to the hidden field and then post the form. Here's the code.
javascript function
function GetTable(which){
var thiselement=document.getElementById("tblnam");
alert(thiselement.value); /* This shows me */
thiselement.value=which.innerText;
document.all.tbltree.submit;
}
This is the resulting page after the previous function.
<form id="tbltree" action="GetData.asp" method="Post">
<Div id="DBStruct" >
<table id="tblList"><input type="hidden" id="tblnam" value="me" />
<tr><td class="tblName" onClick="GetTable(this)">
etc, etc.
I thought that by assigning a value to the input and then calling the submit method the form would post. Is there a way to do this?