Text box validation

C

C. Smith

Front Page 2000, text box validation. I have a non
required email form field, but if the user puts their
email address in it, I want the field validated to make
sure it contains our company's domain (@mycompany.com). I
tried a java script but that didn't seem to work as I'm
using asp/cdonts for the form handler.

Thank you in advance
 
J

Jim Buyens

-----Original Message-----
Front Page 2000, text box validation. I have a non
required email form field, but if the user puts their
email address in it, I want the field validated to make
sure it contains our company's domain (@mycompany.com).
I tried a java script but that didn't seem to work as
I'm using asp/cdonts for the form handler.

I would code:

<%
const myco = "@mycompany.com"
dim errmsg

errmsg = ""
if request("email") <> "" then
if lcase(right(request("email"),12)) <> myco then
errmsg = "E-mail doesn't end in " & myco
end if
end if

if errmsg = "" then
' code to send mail goes here
end if
%>

<p class=err><%=errmsg%></p>

where err refers to a style like the following in a
linked style sheet:

..err {font-weight: bold; color: #990000; }

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top