<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000066">
<font size="-1"><font face="Verdana">I've had good luck using the
Formulator product, it has an email field validation mechanism. Works
very nicely.<br>
<br>
-Jon Cyr<br>
</font></font><br>
Small Business Services wrote:<br>
<blockquote cite="mid0b1e01c4385c$1ccf2260$647ba8c0@jhdesktop"
type="cite">
<pre wrap="">From: "Jianping Zhu" <a class="moz-txt-link-rfc2396E" href="mailto:jzhu@fisher.forestry.uga.edu"><jzhu@fisher.forestry.uga.edu></a>
</pre>
<blockquote type="cite">
<pre wrap="">The situation is that i want user to register. and i want to check the
user-provid email address format.
<dtml if "email=='' or.....">
how can I check the email format?
</pre>
</blockquote>
<pre wrap=""><!---->
Create an external method with the following code:
import re
def isEmail(value):
p =
re.compile(r<a class="moz-txt-link-rfc2396E" href="mailto:(([\'a-zA-Z0-9\_-])*\.)*([\'a-zA-Z0-9\_-])+@([a-zA-Z0-9\_-])+(\.([a-zA-Z0-9])+)+">"(([\'a-zA-Z0-9\_-])*\.)*([\'a-zA-Z0-9\_-])+@([a-zA-Z0-9\_-])+(\
.([a-zA-Z0-9])+)+"</a>)
if p.match(value) :
return 'Valid'
else:
return 'Invalid'
Then you can use dtml to check your email addresses:
<dtml-if "isEmail(somevar) == 'Valid' ">
where 'somevar' is the form field that captured the email address entered by
the user.
HTH
Jonathan
_______________________________________________
Zope maillist - <a class="moz-txt-link-abbreviated" href="mailto:Zope@zope.org">Zope@zope.org</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope</a>
** No cross posts or HTML encoding! **
(Related lists -
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )
</pre>
</blockquote>
</body>
</html>