Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 01:33 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Submit buttons

I'm trying to submit a form to the server but now I am geting a type mismatch error in one file but I'm pretty sure the problem is in another file that references it because I haven't touchecd the other file.Anyway I keep getting the type mismatch error,but I think it's somewhere in my submit button line.
here is the code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Inputting a question</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
 Set MyConn=Server.CreateObject("ADODB.Connection")
 Set Rs=Server.CreateObject("ADODB.RecordSet")
 Set Rs2=Server.CreateObject("ADODB.RecordSet")
 MyConn.Open("mm32")
 Rs.Open "SELECT * From Law WHERE lawNo=" & Request.QueryString("LawNo"), MyConn, 1, 2
 Response.write("Please input a question for<br><b>Law " & Rs("lawNo") & "." & Rs("LawText") & "</b><BR>")
 Rs2.Open "SELECT * FROM Component WHERE lawNo=" & Request.QueryString("LawNo") & " AND componentNo=" & Request.QueryString("ComponentNo"), MyConn, 1, 2
 Response.write(Rs2("componentText") & "<BR>")
 Response.write("")
 %>
<form name="form1" method="post" action="http://pertinax.cms.shu.ac.uk/mmtec/mm32/HandleHughInputAQuestion2.asp?LawNo=<%=Request.Que ryString("LawNo")%>&ComponentNo=<%=Request.QuerySt ring("ComponentNo")%> >
  <p>What is your question:
    <textarea name="Question" cols="120" id="Question"> </textarea>
  </p>
  <table width="99%" border="1">
    <tr>
      <td width="72%">Possible Anwers</td>
      <td width="28%">Is this the correct Answer</td>
    </tr>
    <tr>
      <td><textarea name="Answer1" cols="100" id="textarea"></textarea></td>
      <td><input type="radio" name="Ans" value="1"></td>
    </tr>
    <tr>
      <td><textarea name="Answer2" cols="100" id="textarea2"></textarea></td>
      <td><input type="radio" name="Ans" value="2"></td>
    </tr>
    <tr>
      <td><textarea name="Answer3" cols="100" id="textarea3"></textarea></td>
      <td><input type="radio" name="Ans" value="3"></td>
    </tr>
    <tr>
      <td><textarea name="Answer4" cols="100" id="Answer4"></textarea></td>
      <td><input type="radio" name="Ans" value="4"></td>
    </tr>
  </table>
  <p>What is the explanation
    <textarea name="Explanation" cols="120" id="Explanation"></textarea>
  </p>
  <p>What is an Anecdote
    <textarea name="Anecdote" cols="120" id="Anecdote"></textarea>
  </p>
  <p>What are further thoughts
    <textarea name="FurtherThoughts" cols="120" id="FurtherThoughts"></textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit" onclick="Submit" >
    <input type="reset" name="Submit2" value="Reset">

  <p>&nbsp; </p>
</form>
<p>&nbsp;</p></body>
</html>

I'd be so grateful if someone could point out what I've done wrong


andrew
 
Old August 6th, 2003, 02:26 PM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can u give the line number where it is occuring and possibly a full description of the error?

 
Old August 7th, 2003, 04:52 AM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Error Type:
Provider (0x80020005)
Type mismatch.
/mmtec/mm32/HandleHughInputAQuestion2.asp, line 17.But I don't think it is this line
 This is the script that process data sent by the form here is teh code for
HandleHughInputAQuestion2.asp

<html>
<head>
<TITLE>handlingInput</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  Set MyConn=Server.CreateObject("ADODB.Connection")
  Set Rs=Server.CreateObject("ADODB.RecordSet")
  Set Rs2=Server.CreateObject("ADODB.RecordSet")
  MyConn.Open("mm32")
  Rs.Open "SELECT * From Question WHERE questionNo=1", MyConn, 1, 2
  Rs2.Open "SELECT * From PossibleAnswer WHERE questionNo=1", MyConn, 1, 2
  'Add a record to the Question Table
  Rs.AddNew
      Rs("LawNo")=Request.Querystring("LawNo")
      Rs("ComponentNo")=Request.Querystring("ComponentNo ")
      Rs("questionText")=Request.Form("Question")
      Rs("questionExplanation")=Request.Form("Explanatio n")
      Rs("questionAnecDote")=Request.Form("Anecdote")
      Rs("questionFurtherThoughts")=Request.Form("Furthe rThoughts")
  Rs.Update
   'We need to know the questionNo that was produced by that Update
    Response.write "<P>A new question has been added </p>"_
    & "<p>LawNumber: " & Rs.Fields("LawNo") & "</p>"
  Rs.Close
  Rs.Open "SELECT TOP 1 * From Question ORDER By questionNo DESC", MyConn, 1, 2

 'Add up to 4 records in the PossibleAnswer Table
  If Not Request.Form("Answer1")= "" Then
   Rs2.AddNew
      Rs2("questionNo")=Rs("questionNo")
      Rs2("AnswerNo")=1
      Rs2("answerText")=Request.Form("Answer1")
      If Cint(Request.Form("Ans"))=1 Then
       Rs2("isThisCorrect")=True
      End If
   Rs2.Update
  End If

  If Not Request.Form("Answer2")="" Then
   Rs2.AddNew
      Rs2("questionNo")=Rs("questionNo")
      Rs2("AnswerNo")=2
      Rs2("answerText")=Request.Form("Answer2")
      If Cint(Request.Form("Ans"))=2 Then
       Rs2("isThisCorrect")=True
      End If
   Rs2.Update
  End If


  If Not Request.Form("Answer3")="" Then
   Rs2.AddNew
      Rs2("questionNo")=Rs("questionNo")
      Rs2("AnswerNo")=3
      Rs2("answerText")=Request.Form("Answer3")
      If Cint(Request.Form("Ans"))=3 Then
       Rs2("isThisCorrect")=True
      End If
   Rs2.Update
  End If

  If Not Request.Form("Answer4")="" Then
   Rs2.AddNew
      Rs2("questionNo")=Rs("questionNo")
      Rs2("AnswerNo")=4
      Rs2("answerText")=Request.Form("Answer4")
      If Cint(Request.Form("Ans"))=4 Then
       Rs2("isThisCorrect")=True
      End If
   Rs2.Update
  End If


  %>
</body>
</html>


andrew





Similar Threads
Thread Thread Starter Forum Replies Last Post
One form.. two submit buttons ashraf_gawdat HTML Code Clinic 1 July 28th, 2006 06:56 PM
2 Submit Buttons ... HOW? Benno Dreamweaver (all versions) 1 November 23rd, 2004 12:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.