Print Page | Close Window

what is wrong with this asp-page?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1673
Printed Date: 29 March 2026 at 8:32am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: what is wrong with this asp-page?
Posted By: eagle00789
Subject: what is wrong with this asp-page?
Date Posted: 08 April 2003 at 2:12am

what is wrong with the below asp-page. if i neter a wrong verificationcode it still sends the e-mail.

----- begin op ziekmelding.asp -----

<html>
<head>
<title>CDONTS Test</title>
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/kids/kids1111.css"><meta name="Microsoft Theme" content="kids 1111">
<script language="JavaScript">
<!-- Hide from older browsers...

//Function to check form is filled in correctly before submitting
function CheckForm () {

 //Check for a valid code
 if (document.frmNewForum.Verify.value==document.frmNewForum.Code.value){
  alert("Please enter a valid code");
  return false;
 }
 
 return true
}
// -->
</script>
</head>
<body onload="javascript:{if(parent.frames[0]&&parent.frames['menu'].Go)parent.frames['menu'].Go()}">
<center>
<table width="500">

<%
If request.form("action")="Verstuur" then
    on error resume next
    Set Mail = CreateObject("CDONTS.Newmail")
    if err.number = 0 then
        Mail.From = "Gravenrode Website< mailto:webmaster@gravenrode.nl - webmaster@gravenrode.nl >"
        Mail.To = request.form("Locatie")
        Mail.Subject = "Ziekmelding"
        Mail.BodyFormat = 0
        Mail.MailFormat = 0
        HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
        HTML = HTML & "<html>" & vbCrLf
        HTML = HTML & "<head>" & vbCrLf
        HTML = HTML & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">" & vbCrLf
        HTML = HTML & "<title>Ziekmelding</title>" & vbCrLf
        HTML = HTML & "</head>" & vbCrLf
        HTML = HTML & "<body>" & vbCrLf
        HTML = HTML & "<h1>Ziekmelding</h1>" & vbCrLf
        HTML = HTML & "Via de website is <b>" + request.form("Naam") + "</b> ziekgemeld geworden.<br>" & vbCrLf
        HTML = HTML & "Hij/Zij zit in groep <b>" + request.form("Groep") + "</b>." & vbCrLf
        HTML = HTML & "</body>" & vbCrLf
        HTML = HTML & "</html>"
        Mail.Body = HTML
        Mail.Importance = 2
        Mail.Send
        Set Mail = Nothing
%>
<tr>
  <td align="center">
  <b>Ziekemelding</b>
  <p>Uw ziekmelding is verstuurd.
  <% else %>
  <td align="center">
  <font face="arial">
  <h3>Test Completed</h3>
  <p>Er is een onbekende fout opgetreden.
  <% end if %>
  </td>
</tr>

<% Else %>
<tr>
  <td align="center">
    <font face="times new roman">
    <h2 align="center"><i>Ziekmelding</i></h2></font>
    <font face="Arial">
    <form action="ziekmelding.asp" method="POST" onSubmit="return CheckForm();">
    <p align="center">U kunt door middel van het formulier hieronder uw kind ziekmelden<br>
    <div align="center">
      <center><pre>De naam van uw kind: <input type="text" name="Naam" size="20">
      De groep van uw kind:<select name="Groep" size="1" width="25">
<option selected>Selecteer de groep van uw kind</option>
<option value="1/2a">Groep 1/2a</option>
<option value="1/2b">Groep 1/2b</option>
<option value="1/2c">Groep 1/2c</option>
<option value="3.0">Groep 3.0</option>
<option value="3.1/4.1">Groep 3.1/4.1</option>
<option value="4.0">Groep 4.0</option>
<option value="5.0/6.0">Groep 5.0/6.0</option>
<option value="5.1/6.1">Groep 5.1/6.1</option>
<option value="6.01/7.0">Groep 6.01/7.0</option>
<option value="7.1">Groep 7.1</option>
<option value="8.0">Groep 8.0</option>
<option value="8.1">Groep 8.1</option>
</select>
      De locatie van uw kind:<select name="Locatie" size="1" width="25">
<option selected>Selecteer de locatie van uw kind</option>
<option value="mailto:c.simon@gravenrode.nl">Locatie'>c.simon@gravenrode.nl">Locatie Achter de Winkel</option>
<option value="mailto:c.simon@gravenrode.nl">Locatie'>c.simon@gravenrode.nl">Locatie De Wendel</option>
</select>
    Verificatiecode: <input type="integer" name="Verify" size="20"><br>
    Type de onderstaande code in het vak hierboven:<br>
<%
Randomize()
Code = rnd()
response.write (right(round(Code,6),6))
%>
    </pre>
      </center>
    </div>
    <p align="center"><center>
    <input type="hidden" name="Code" Value=Code>
    <input type="SUBMIT" name="action" value="Verstuur">
    <input type="RESET" value="Wissen"></center></form></font>
    </td>
<% End If %>
</table>
</body>
</html>

----- end ziekmelding.asp -----



-------------
Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here



Replies:
Posted By: ultramods
Date Posted: 08 April 2003 at 4:54am

I have found a couple of things. You didnt name your form so that function checkform couldnt see the form objects.

<form name=frmNewForum action="ziekmelding.asp"

Also

it shoud be an error if Verify isnt equal to Code, so use !

if (document.frmNewForum.Verify.value !==document.frmNewForum.Code.value).

Hope that helps.



Posted By: eagle00789
Date Posted: 08 April 2003 at 5:10am
it works partially. i now do get a message when i enter an incorrect code, but if i enter a correct code it also gives me the same message

-------------
Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here


Posted By: ultramods
Date Posted: 08 April 2003 at 5:16am
Can you show me your new code please as i tested it, and it all worked fine.


Posted By: ultramods
Date Posted: 08 April 2003 at 5:19am

Sorry i forgot to add the final part.

<input type="hidden" name="Code" Value=<%=right(round(Code,6),6)%>>



Posted By: eagle00789
Date Posted: 08 April 2003 at 5:24am

that just made it work like it should. but for the record, hee is my code as i have it now:

----- begin of ziekmelding.asp -----
<html>
<head>
<title>CDONTS Test</title>
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/kids/kids1111.css"><meta name="Microsoft Theme" content="kids 1111">
<script language="JavaScript">
<!-- Hide from older browsers...

//Function to check form is filled in correctly before submitting
function CheckForm () {

 //Check for a valid code
 if (document.frmNewForum.Verify.value!==document.frmNewForum.Code.value){
  alert("Please enter a valid code");
  return false;
 }
 
 return true
}
// -->
</script>
</head>
<body onload="javascript:{if(parent.frames[0]&&parent.frames['menu'].Go)parent.frames['menu'].Go()}">
<center>
<table width="500">

<%
If request.form("action")="Verstuur" then
    on error resume next
    Set Mail = CreateObject("CDONTS.Newmail")
    if err.number = 0 then
        Mail.From = "Gravenrode Website< mailto:webmaster@gravenrode.nl - webmaster@gravenrode.nl >"
        Mail.To = request.form("Locatie")
        Mail.Subject = "Ziekmelding"
        Mail.BodyFormat = 0
        Mail.MailFormat = 0
        HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
        HTML = HTML & "<html>" & vbCrLf
        HTML = HTML & "<head>" & vbCrLf
        HTML = HTML & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">" & vbCrLf
        HTML = HTML & "<title>Ziekmelding</title>" & vbCrLf
        HTML = HTML & "</head>" & vbCrLf
        HTML = HTML & "<body>" & vbCrLf
        HTML = HTML & "<h1>Ziekmelding</h1>" & vbCrLf
        HTML = HTML & "Via de website is <b>" + request.form("Naam") + "</b> ziekgemeld geworden.<br>" & vbCrLf
        HTML = HTML & "Hij/Zij zit in groep <b>" + request.form("Groep") + "</b>." & vbCrLf
        HTML = HTML & "</body>" & vbCrLf
        HTML = HTML & "</html>"
        Mail.Body = HTML
        Mail.Importance = 2
        Mail.Send
        Set Mail = Nothing
%>
<tr>
  <td align="center">
  <b>Ziekemelding</b>
  <p>Uw ziekmelding is verstuurd.
  <% else %>
  <td align="center">
  <font face="arial">
  <h3>Test Completed</h3>
  <p>Er is een onbekende fout opgetreden.
  <% end if %>
  </td>
</tr>

<% Else %>
<tr>
  <td align="center">
    <font face="times new roman">
    <h2 align="center"><i>Ziekmelding</i></h2></font>
    <font face="Arial">
    <form Name=frmNewForum action="ziekmelding.asp" method="POST" onSubmit="return CheckForm();">
    <p align="center">U kunt door middel van het formulier hieronder uw kind ziekmelden<br>
    <div align="center">
      <center><pre>De naam van uw kind: <input type="text" name="Naam" size="20">
      De groep van uw kind:<select name="Groep" size="1" width="25">
<option selected>Selecteer de groep van uw kind</option>
<option value="1/2a">Groep 1/2a</option>
<option value="1/2b">Groep 1/2b</option>
<option value="1/2c">Groep 1/2c</option>
<option value="3.0">Groep 3.0</option>
<option value="3.1/4.1">Groep 3.1/4.1</option>
<option value="4.0">Groep 4.0</option>
<option value="5.0/6.0">Groep 5.0/6.0</option>
<option value="5.1/6.1">Groep 5.1/6.1</option>
<option value="6.01/7.0">Groep 6.01/7.0</option>
<option value="7.1">Groep 7.1</option>
<option value="8.0">Groep 8.0</option>
<option value="8.1">Groep 8.1</option>
</select>
      De locatie van uw kind:<select name="Locatie" size="1" width="25">
<option selected>Selecteer de locatie van uw kind</option>
<option value="mailto:c.simon@gravenrode.nl">Locatie'>c.simon@gravenrode.nl">Locatie Achter de Winkel</option>
<option value="mailto:c.simon@gravenrode.nl">Locatie'>c.simon@gravenrode.nl">Locatie De Wendel</option>
</select>
    Verificatiecode: <input type="integer" name="Verify" size="20"><br>
    Type de onderstaande code in het vak hierboven:<br>
<%
Randomize()
tmp = rnd()
Code = right(round(tmp,6),6)
response.write (Code)
%>
    </pre>
      </center>
    </div>
    <p align="center"><center>
    <input type="hidden" name="Code" Value="<% = Code %>">
    <input type="SUBMIT" name="action" value="Verstuur">
    <input type="RESET" value="Wissen"></center></form></font>
    </td>
<% End If %>
<%
set Code = Nothing
%>
</table>
</body>
</html>
----- end of ziekmelding.asp -----



-------------
Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net