I am trying to add some data validation methods to my fieldProduct 
( www.zope.com/Members/gchiu ) - a data entry class.

I have added a method called isNotEmail which returns either a 0 or a 1.

Here's the method definition:

<dtml-if "_.has_key(fieldName)">

   <dtml-call "REQUEST.set(_[fieldName],_.string.lower(_[fieldName]))">
   <dtml-if "_.len(_[fieldName]) <8 or _.string.find(_[fieldName],'@')==-1 or 
       _.string.find(_[fieldName],'.')==-1 or 
       _.string.rfind(_[fieldName],'.') < _.string.find(_[fieldName],'@') or
       _.string.find(_[fieldName],'nospam') > 0 or
       _.string.find(_[fieldName],'..')>0 ">
      <dtml-call "REQUEST.set(_['fieldNameError'],'This is not a valid email address.
Please amend.')">
      <dtml-return "0">
   <dtml-else>
      <dtml-return "1">
   </dtml-if>     
<dtml-else>
   <dtml-call "REQUEST.set(_['fieldNameError'],'You need to supply a <b>valid</b>
email address')">  
   <dtml-return "0">
</dtml-if>

where fieldName and fieldNameError are properties of the class.

However, when I call the method

<dtml-var "REQUEST.set('error',f_Email.isNotEmail(f_Email,_))">

where f_Email is an instance of the product, then the words

'None'

are returned as well, and render to the screen.

Where is this coming from?

-- 
Regards,  Graham Chiu
gchiu<at>compkarori.co.nz
http://www.compkarori.co.nz/index.php
Powered by Interbase and Zope

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to