If Textfield = Textfield then = "Korrekt" else = "forkert"
Hej Expertbrugere...På siden forsidetest.asp har jeg en form som jeg poster til siden test.asp
Mit spørgmål:
Jeg vil gerne "validere" feltet: EngOrd med feltet: EngTestOrd
Dvs. at hvis "IF" textfield: Engord er det samme som = "Then" textfield: engTestOrd. Så response.Write = Det er korrekt
Hvis textfield: EngOrd IKKE er det samme som Textfield: engTestOrd. else = response.write Det er forkert
If Textfield = Textfield then response.write Korrekt else Forkert
SE EVT. SCRIPT NEDENUNDER!
THX ALOT :)
forsidetest.asp:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsOrd 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Ordbog.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsOrd = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT KategoriA.* FROM KategoriA WHERE ID_nr=" & lngRecordNo
'Open the recordset with the SQL query
rsOrd.Open strSQL, adoCon
%>
<form id="FormName" action="test.asp" method="post" name="FormName">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div align="right">
<font size="2" color="#ff3300" face="Verdana, Arial, Helvetica, sans-serif"><b>SpørgsmålsID = <input type="hidden" name="ID_nr" value="<% = rsOrd("ID_nr") %>"><% = rsOrd("ID_nr") %></b></font></div>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<div align="center">
<font size="2" face="verdana">Engelsk Ord - Antal bogstaver =</font><font size="2" color="white" face="verdana"> </font><font size="1" color="white" face="Verdana, Arial, Helvetica, sans-serif"><% = rsOrd("EngOrd") %><input type="hidden" name="EngOrd" value="<% = rsOrd("EngOrd") %>"></font></div>
</td>
</tr>
<tr>
<td>
<div align="center">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Dansk Ord</font></div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="text" name="DkOrd" value='<% = rsOrd("DkOrd") %>' readonly size="40"></div>
</td>
</tr>
<tr>
<td>
<div align="center">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Ord som skal skrives færdigt</font></div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="text" name="EngTestOrd" value='<% = rsOrd("EngTestOrd") %>' size="40"></div>
</td>
</tr>
<tr>
<td>
<div align="center">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Kategori <% = rsOrd("Kategori") %>. - Sværhedsgrad = <% = rsOrd("OrdValue") %></b></font></div>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<div align="right">
<input type="submit" name="submitButtonName" value="Næste"></div>
</td>
</tr>
</table>
</form>
forsidetest.asp: Slut
_________________________________________________________________
Test.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive">
<title>Utest</title>
</head>
<body bgcolor="#ffffff">
<p><%
dim ID_nr, EngOrd, DKOrd, EngTestOrd
ID_nr=Request.Form("ID_nr")
EngOrd=Request.Form("EngOrd")
DKOrd=Request.Form("DKOrd")
EngtestOrd=Request.Form("EngtestOrd")
If EngOrd <> EngTestOrd Then
Response.Write("<font size=2 face=Verdana, Arial, Helvetica, sans-serif><div align=center><b>")
Response.Write("Godt svaret, det er korrekt!!!")
Response.Write("</b></div>")
End If
%><% Response.Write("" & ID_nr & " ") %><br><% Response.Write("" & EngOrd & " ") %><br><% Response.Write("" & DKOrd & " ") %><br><% Response.Write("" & EngtestOrd & " ") %><br> </p>
</body>
</html>
test.asp: SLUT