Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Forms Collection

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,42819
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Forms Collection
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Forms Collection - 2/2/2007 6:39:57 AM   
  mmcool

 

Posts: 1
Score: 0
Joined: 2/2/2007
Status: offline
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>
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Forms Collection Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts