I have this form:

form = SQLFORM.factory(
Field('first_name', requires=IS_NOT_EMPTY() ),
Field('last_name', requires=IS_NOT_EMPTY() ),
Field('email_work', requires=[IS_EMAIL(error_message='invalid email!')]),
Field('email_home', requires = IS_EMAIL(error_message='invalid email!')),
submit_button = submit_button_text                           
)

Right now if email_work AND email_home are not blank I get an error message
'invalid email' which is OK.

What I want as a better solution is web2py not to check if email is valid 
if 
email_work  OR email_home are blank. Only if not blank is submitted then to 
check if it is a valid email address.

How to accomplish this?

Reply via email to