Forms Collection

Author Message
mmcool

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 2/2/2007
  • Status: offline
Forms Collection Friday, February 02, 2007 7:39 AM (permalink)
0
I'm a complete noob with vbScript and I could use a little advice.  I've got a form created by two queries.  The first query gets questions from a survey and the second gets the possible answers for each question.  The intent is to loop through a respondent's answers and insert the values back into the table.  Because the form is created dynamically, I have to loop through the forms collection to get the data I need to insert.  When I attempt to loop through the form, I get an error stating "Object Required: Request".  The code is shown below:
 

<HTML>

<head>
<TITLE>
Risk Assessment Questionnaire</title>
</HEAD>

<BODY>

<H3>
2007 Audit Plan

<BR>
Risk Assessment Questionnaire

</H3>
<SCRIPT LANGUAGE
="VBScript">

<!--
Sub Submit_OnClick

for each x in Request.Form
msgbox(Request.Form(x))
next
End Sub
-->

</SCRIPT>

<%
dim QID
set cmd = Server.CreateObject("ADODB.Command")
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open Application("Auditsurvey_connectionstring")

Set Cmd.ActiveConnection = MyConn
SQL_query = "SELECT * FROM tblQuestions"
SQL_query2 = "Select * from tblAnswers where QID = ? ORDER BY AID"

Set RS = MyConn.Execute(SQL_query)
%>



<FORM NAME=
"Form1" method="POST">

<OL>

<%
WHILE NOT RS.EOF
%>

<li>

<%=RS("QUESTION")%>

<%
Cmd.CommandText = sql_query2
set rs2 = cmd.execute(,RS("QID"))
WHILE NOT RS2.eof
%>

<BR>&nbsp;&nbsp;&nbsp; <INPUT TYPE=RADIO NAME= <%=RS("QID")%> VALUE= <%=RS2("AID")%> > <%=RS2("ANSWER")%>
<%
RS2.MoveNext
WEND
RS2.Close %>

<P>

<%
RS.MoveNext
WEND
RS.Close
MyConn.Close
%>

<INPUT NAME=
"Submit" TYPE="BUTTON" VALUE="Submit">
</FORM>
</BODY>
</HTML>
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9