<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<center><h1>Membership Form</h1></center>
<form method="post" action="index.asp">
<label>LastName: </label> <input type="text" name="txtln">
<label>FirstName: </label> <input type="text" name="txtfn">
<label>M.I.: </label> <input type="text" name="txtmi"> <br>
<label>Address: </label> <input type="text" name="txtadd"> <br>
<label>Username: </label> <input type="text" name="txtuser"> <br>
<label>Password: </label> <input type="password" name="txtpw"> <br>
<label>Confirm Password: </label> <input type="password" name="txtpw2"><br>
<input type="submit" value="SUBMIT" name="btnsubmit"><input type="reset" value="RESET">
</form>
<%
Dim lname, fname, middle, address, user, password
lname=trim(Request.Form("txtln"))
fname=trim(Request.Form("txtfn"))
middle=trim(Request.Form("txtmi"))
address=trim(Request.Form("txtadd"))
user=trim(Request.Form("txtuser"))
password=trim(Request.Form("txtpw"))
password2=trim(Request.Form("txtpw2"))
If (IsEmpty("lname") OR IsEmpty("fname") OR IsEmpty("middle") OR IsEmpty("address") OR IsEmpty("user") OR IsEmpty("password") OR IsEmpty("password2")) then
response.write("Please fill up the necessary fields!")
Else
response.write("Name: " &fname&" " &middle&" "&lname& "<br> Address:"&" "&address &"<br>Username: "&user&"<br>Password: "&password & "<br>Confirm Password: "&password2)
End If
%>
</body>
</html>
Error Trapping for Empty Form
Page 1 of 11 Replies - 1099 Views - Last Post: 11 July 2012 - 04:21 AM
#1
Error Trapping for Empty Form
Posted 10 July 2012 - 11:11 AM
Please help me with my error trapping... If textboxes were empty it should display, Fill up necessary fields but I have my condition and everything and its just blank! We were asked to use IsEmpty() function. I need modification with my conditional statement. We use ASP classic not .net. THANKS!
Replies To: Error Trapping for Empty Form
#2
Re: Error Trapping for Empty Form
Posted 11 July 2012 - 04:21 AM
I don't think you should write variables name in double quotation, in if statement.
you will never receive this message:
because all IsEmpty functions have string values in "double quotation" but not variables name.
If (IsEmpty("lname") OR IsEmpty("fname") OR IsEmpty("middle") OR IsEmpty("address") OR IsEmpty("user") OR IsEmpty("password") OR IsEmpty("password2"))
you will never receive this message:
response.write("Please fill up the necessary fields!")
because all IsEmpty functions have string values in "double quotation" but not variables name.
This post has been edited by zeeshanef: 11 July 2012 - 04:25 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|