Hvor er fejlen i min validering??
Hej der ud, håber der er nogen, der kan give mig en hånd med det følgede.Det handler om validering af information, der bliver indtastet i \"contact_form.html\" og valideret i \"validering.asp\". Men lige meget hvad jeg gør bliver indtastingen valideret som om der er fejl.
Jeg har kontrolleret min indtastning, det er ikke der det går galt; men jeg kan simpelthen ikke finde fejlen.
Er der nogen af jer der ude der kan??
Siden: contact_form.html
<html>
<head>
<title>Contact</title>
</head>
<body bgcolor=\"#FFFFFF\" text=\"#000000\">
<table width=\"400\" border=\"0\" cellspacing=\"6\" height=\"400\">
<tr>
<td colspan=\"4\">Contact</td>
</tr>
<tr>
<td colspan=\"4\"> </td>
</tr>
<tr>
<td colspan=\"4\">Please fill in the following form to contact:</td>
</tr>
<tr>
<td colspan=\"4\"> </td>
</tr>
<form name=\"contact\" method=\"post\" action=\"validering.asp\">
<tr>
<td width=\"96\">Titel:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"titel\">
</td>
</tr>
<tr>
<td width=\"96\">Name<font color=\"red\">*</font>:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"name\">
</td>
</tr>
<tr>
<td width=\"96\">Company:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"company\">
</td>
</tr>
<tr>
<td width=\"96\">Address:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"address\">
</td>
</tr>
<tr>
<td width=\"96\">Postal code:</td>
<td width=\"50\">
<input type=\"text\" size=\"8\" name=\"postal_code\">
</td>
<td width=\"82\">City/ Town:</td>
<td width=\"134\">
<input type=\"text\" size=\"15\" name=\"city\">
</td>
</tr>
<tr>
<td width=\"96\">Country<font color=\"red\">*</font>::</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"country\">
</td>
</tr>
<tr>
<td width=\"96\">E - mail<font color=\"red\">*</font>:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"email>
</td>
</tr>
<tr>
<td colspan=\"4\">
</td>
</tr>
<tr>
<td width=\"96\">Telefon:</td>
<td colspan=\"3\">
<input type=\"text\" size=\"44\" name=\"telefon\">
</td>
</tr>
<tr>
<td colspan=\"4\">Do you want to be contacted be one of our consulents?<br>
If yes, in wi way:</td>
</tr>
<tr>
<td colspan=\"2\">
<input type=\"radio\" name=\"contact\" value=\"Contact by e-mail\">
E- mail </td>
<td colspan=\"2\">
<input type=\"radio\" name=\"contact\" value=\"Contact by telefon\">
Telefon </td>
</tr>
<tr>
<td colspan=\"4\"> </td>
</tr>
<tr>
<td colspan=\"4\">Subject<font color=\"red\">*</font>:</td>
</tr>
<tr>
<td colspan=\"4\">
<input type=\"text\" size=\"58\"name=\"subject\">
</td>
</tr>
<tr>
<td colspan=\"4\">Details<font color=\"red\">*</font>:</td>
</tr>
<tr>
<td colspan=\"4\" height=\"88\">
<textarea name=\"details\" cols=\"58\" wrap=\"VIRTUAL\" rows=\"6\"></textarea>
</td>
</tr>
<tr>
<td colspan=\"4\" height=\"14\">
<input type=\"submit\" name=\"Submit\" value=\"Send\">
</td>
</tr>
<tr>
<td colspan=\"4\" height=\"14\">Please note! <br>
All fields marked with an asterisk(<font color=\"red\">*</font>) are required.
td>
</tr>
</form>
</table>
</body>
</html>
Siden: validering.asp
<%
\'Her fjernes \' og \" for at ikke komme i kambolage med VBScript\'s måde at skrive på.
Form_Titel = Trim(Replace(Request.Form(\"titel\"),\"\"\"\",\"\"\"\"\"\"))
Form_Name = Trim(Replace(Request.Form(\"name\"),\"\"\"\",\"\"\"\"\"\"))
Form_Company = Trim(Replace(Request.Form(\"company\"),\"\"\"\",\"\"\"\"\"\"))
Form_Address = Trim(Replace(Request.Form(\"address\"),\"\"\"\",\"\"\"\"\"\"))
Form_Postal_code = Trim(Replace(Request.Form(\"postal_code\"),\"\"\"\",\"\"\"\"\"\"))
Form_City = Trim(Replace(Request.Form(\"city\"),\"\"\"\",\"\"\"\"\"\"))
Form_Country = Trim(Replace(Request.Form(\"country\"),\"\"\"\",\"\"\"\"\"\"))
Form_Email = Trim(Replace(Request.Form(\"email\"),\"\"\"\",\"\"\"\"\"\"))
Form_Telefon = Trim(Replace(Request.Form(\"telefon\"),\"\"\"\",\"\"\"\"\"\"))
Form_Subject = Trim(Replace(Request.Form(\"subject\"),\"\"\"\",\"\"\"\"\"\"))
Form_Details = Trim(Replace(Request.Form(\"details\"),\"\"\"\",\"\"\"\"\"\"))
\'Da der er tale om radiobuttons er der ikke brug for \"Replace\" funktion på disse.
Form_Contact = Request.Form(\"contact\")
\'Her starter valideringen
Validated_Form = true
\'Undersøger om der er noget og om det er korrekte intastet i name feltet.
IF len(Form_Name)<2 THEN \'Der skal minimum være 2 tegn intastet.
Validated_Form = false
END IF
IF len(Form_Country)<2 THEN \'Der skal minimum være 2 tegn intastet.
Validated_Form = false
END IF
IF len(Form_Email)<6 OR InStr(Form_Email,\"@\")=0 THEN \'Der skal minimum være 6 tegn intastet og @ skal være et af dem.
Validated_Form = false
END IF
IF len(Form_Subject)<3 THEN \'Der skal minimum være 3 tegn intastet.
Validated_Form = false
END IF
IF len(Form_Details)<3 THEN \'Der skal minimum være 3 tegn intastet.
Validated_Form = false
END IF
\'Hvis indtastningen ikke er korrekt vises følgende.
IF NOT Validated_Form THEN
%>
<html>
<head>
<title>Contact</title>
</head>
<body>
Error. Click back in your browser, and fill the form out properly.
</body>
</html>
<%
\'Dette vises derimod, hvis intastningen er korrekt.
ELSE
%>
<html>
<head>
<title>Contact</title>
</head>
<body>
Thank for sharing you information, we will answer you as fast as possible, or after request.
<BR>
<BR>
You submitted the following information:<BR>
Titel: <%=Form_Titel%><BR>
Name: <%=Form_Name%><BR>
Company: <%=Form_Company%><BR>
Address: <%=Form_Address%><BR>
Postal code: <%=Form_Postal_code%><BR>
City/ Town: <%=Form_City%><BR>
Country: <%=Form_Country%><BR>
E-mail: <%=Form_Email%><BR>
Telefon: <%=Form_Telefon%><BR><BR>
Subject: <%=Form_Subject%><BR>
Details: <%=Form_Details%><BR>
</body>
</html>
<%
END IF
%>
På forhånd tak for hjælpen.
MVH
Scorpion
