[Zope] dtml: how to check email address format?

Small Business Services toolkit at magma.ca
Wed May 12 16:02:48 EDT 2004

From: "Jianping Zhu" <jzhu at fisher.forestry.uga.edu>
> 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?

Create an external method with the following code:

import re

def isEmail(value):

  p =
  if p.match(value) :
    return 'Valid'
    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.



More information about the Zope mailing list