[thelist] Form Validation Bug

Gary Koh gktbone at yahoo.com
Tue Jul 9 23:10:01 CDT 2002

Hello, I have read up an article cooncerning smart
wed-based forms written by mwarden at

I have tried to create validation form after reading
the article. Upon submitting the form, the input
fields will be proccessed and any incorrectly entered
text fields will be highlighted red. Correct fields
will be left in black. However, theres a bug in my
coding which always highlight all the fields
regardless if they have been correctly or incorrectly

Dim sid, spw, sname, sadd, stel, smail, sstatus
sid = trim(request.form("uid"))
spw = trim(request.form("upw"))
sstatus = trim(request.form("select"))
sname = trim(request.form("uname"))
sadd = trim(request.form("uadd"))
stel = trim(request.form("utel"))
smail = trim(request.form("umail"))

if sid="" then bGoodid=false else bGoodid=true
if spw="" then bGoodpw=false else bGoodpw=true
if sstatus="" then bGoodstatus=false else
if sname="" then bGoodname=false else bGoodname=true
if sadd="" then bGoodadd=false else bGoodadd=true
if stel="" then bGoodtel=false else bGoodtel=true
if smail="" then bGoodmail=false else bGoodmail=true

bGoodPost = (bGoodid and bGoodpw and bGoodstatus and
bGoodname and bGoodadd and bGoodtel and bGoodmail)

if bGoodPost then
"All data that was entered by user will be stored
within the database"

End If
End Sub

Sub displayerror()

<form name="form3" form method="POST"
<input type="hidden" name="action2" value="Save Form
Data2" />

	<%if not bGoodid then response.write "

	value="<%Response.Write request.form("uid")%>"

The code seems logical to me. If bGoodid=false then
text to be highlighted, if bGoodid=true, then it
remains the same.

I hope you guys can help me out with this one. Thanks.

Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

More information about the thelist mailing list