komquat Posted May 8, 2007 Share Posted May 8, 2007 I can not get variables to post from my form submited by JAvascript onclick, please helpHere is my relavent code: 'Start of the main menu tableresponse.write "<table align=right height=15 cellspacing=0 cellpadding=0 border=0>"response.write "<tr>"response.write "<td width=5 bgcolor=075B11 height=8> </TD>"Do while not rstmenu.EOF response.write "<form type=post id=test>" response.write "<input type=hidden name=submenu value='yes'>" response.write "<input type=hidden name=menu_id value='" & rstmenu("menu_id") & "'>" response.write "<td width=5 bgcolor=075B11 height=8><font face='Arial, Helvetica, sans-serif' color=white size=1><a href=andy_menu_trial.asp onclick='document.test.submit();return false'>" & rstmenu("menu_title") & "</a></font></td>" response.write "<td width=5 bgcolor=075b11 height=8> </TD>" response.write "</form>"rstmenu.MoveNextLoop'Finish the tableresponse.write "</tr>"response.write "</table>"%> </td> </tr> <tr> <td colspan=2 align=right><%response.write request("submenu")If request("submenu") = "yes" Then '################################# '# Contains the Link Information # '################################# ' Define Connection String' strsubcnn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\Smelter\Lab\DB\menu_trial.mdb;" ' Open connection' set cnnsubmenu = server.createobject("ADODB.Connection")' cnnsubmenu.open strsubcnn' Set rstsubmenu = server.createobject("ADODB.recordset")' rstsubmenu.open strsubSQL, cnnmenu 'Start of the sub menu table response.write "<table align=right height=15 cellspacing=0 cellpadding=0 border=0>" response.write "<tr>" response.write "<td width=5 bgcolor=009ACD height=8> </TD>" Do while not rstsubmenu.EOF response.write "<td width=5 bgcolor=009ACD height=8><font face='Arial, Helvetica, sans-serif' color=white size=1><a href=reports/" & rstsubmenu("submenu_link") & ">" & rstsubmenu("sub_menu") & "</a></font></td>" response.write "<td width=5 bgcolor=009ACD height=8> </TD>" rstsubmenu.MoveNext Loop 'Finish the table response.write "</tr>" response.write "</table>"End if[ocde] Link to comment Share on other sites More sharing options...
aspnetguy Posted May 8, 2007 Share Posted May 8, 2007 There are a few things wrong with your code.First off, there is no type attribute for forms it should be method="post" and you are trying to submit the form with document.name.submit but you do not have a name assigned to the form. Also you do not have an action assigned to the form.setup your form something like this response.write "<form method=\"post\" id=\"test\" name=\"test\" action=\"processingPage.asp\">" Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.