dtml: how to check email address format?
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? Thanks
From: "Jianping Zhu" <jzhu@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
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@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@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 )
participants (3)
-
Jianping Zhu -
Jonathan Cyr -
Small Business Services