|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 %> |
|
#2
|
|||
|
|||
|
what's happening? is it redirecting? is the page displaying blank? are you getting an error message? what's the error message?
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > cant get first ? to display...error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|