ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 6th, 2003, 09:43 AM
laridev laridev is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy cant get first ? to display...error

when i run this script I cannnot get the first question to display....any suggestions?

<%@ Language=VBScript %>

<%
Option Explicit
%>

<!-- #INCLUDE FILE = "DatabaseConnection.asp" -->

<% 'Variable definition
Dim LconConnection
Dim LrecQuestionAnswers
Dim LstrQuestionID


'Extract Question ID
If Request.QueryString("txtQuestionID") = "1" Then
LstrQuestionID = Request.Form("txtQuestionID")
Else
LstrQuestionID = Request.QueryString("txtQuestionID")
End If
If LstrQuestionID = "1" Then
Response.Redirect("SurveyError.asp?txtError=txtQuestionID+Not+Provide d+To+AskSurvey")
End If
If Not IsNumeric(LstrQuestionID) Then
Response.Redirect("SurveyError.asp?txtError=txtQuestionID+Provided+To +AskSurvey+Is+Not+Numeric")
End If

'Open recordset
Set LconConnection = Server.CreateObject("ADODB.Connection")
Set LrecQuestionAnswers = Server.CreateObject("ADODB.Recordset")

LconConnection.Open MstrConnection
LrecQuestionAnswers.Open _
"SELECT * FROM vwQuestionAnswers WHERE QuestionID = '" & LstrQuestionID & "' ORDER BY AnswerID;", _
LconConnection, _
3 'adOpenStatic

If LrecQuestionAnswers.EOF And LrecQuestionAnswers.BOF Then
Response.Redirect("SurveyError.asp?txtError=No+Survey+Found+For+txtQu estionID+" & Server.URLEncode(LstrQuestionID) & "+In+AskSurvey")
End If
%>


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function validateSurvey()
{
var LblnOK = false;

for (LintCounter = 0; LintCounter < document.frmSurvey.elements.length; LintCounter ++)
{
//Checkbox or radio button
if ((document.frmSurvey.elements[LintCounter].type == 'checkbox') || (document.frmSurvey.elements[LintCounter].type == 'radio'))
{
if (document.frmSurvey.elements[LintCounter].checked == true)
{
LblnOK = true;
break;
}
}
}

//Error check
if (LblnOK == false)
{
alert('Please select an answer and submit again');
return false;
}

return true;

}
</SCRIPT>
<TITLE>Survey Question</TITLE>
</HEAD>
<BODY>
<TABLE BORDER="0">
<FORM NAME="frmSurvey" METHOD="POST" ACTION="ProcessSurvey.asp" ONSUBMIT="return validateSurvey();">
<INPUT TYPE="HIDDEN" NAME="txtQuestionID" VALUE="<%=LstrQuestionID%>">
<TR>
<TD>
<%=LrecQuestionAnswers.Fields("QuestionDescription").Value%>
</TD>
</TR>
<%
Do While Not LrecQuestionAnswers.EOF
%>
<TR>
<TD>
<%
If LrecQuestionAnswers.Fields("QuestionType").Value = 1 Then
'Single Answer
%>
<INPUT TYPE="RADIO" VALUE="<%=LrecQuestionAnswers.Fields("AnswerID")%>" NAME="optAnswer">
<%Else
'Multiple Answer
%>
<INPUT TYPE="CHECKBOX" VALUE="<%=LrecQuestionAnswers.Fields("AnswerID")%>" NAME="chkAnswer<%=LrecQuestionAnswers.Fields("AnswerID")%>" >
<%End If%>
<%=LrecQuestionAnswers.Fields("AnswerDescription").Value%>
</TD>
</TR>
<%
LrecQuestionAnswers.MoveNext
Loop
%>
<TR>
<TD>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</TD>
</TR>
</FORM>
</TABLE>
</BODY>
</HTML>

<%
'Tidy up
LrecQuestionAnswers.Close
LconConnection.Close
Set LrecQuestionAnswers = Nothing
Set LconConnection = Nothing

%>

Reply With Quote
  #2  
Old January 6th, 2003, 06:12 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
what's happening? is it redirecting? is the page displaying blank? are you getting an error message? what's the error message?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > cant get first ? to display...error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT