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

Jonathan Cyr cyrj at cyr.info
Wed May 12 18:08:25 EDT 2004


I've had good luck using the Formulator product, it has an email field 
validation mechanism.  Works very nicely.

-Jon Cyr

Small Business Services wrote:

>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 =
>re.compile(r"(([\'a-zA-Z0-9\_-])*\.)*([\'a-zA-Z0-9\_-])+@([a-zA-Z0-9\_-])+(\
>.([a-zA-Z0-9])+)+")
>  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  -  Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20040512/d2022168/attachment.html


More information about the Zope mailing list