Changeset 2232 in products


Ignore:
Timestamp:
Apr 29, 2010 9:10:08 AM (14 years ago)
Author:
olha
Message:

README file updated with usage exmaple.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.z3cform.captcha/trunk/README.txt

    r2218 r2232  
    44quintagroup.z3cform.captcha is a package that allows to add captcha to the z3c.form. 
    55As a result such forms are prevented from automatic submit. 
     6 
     7Captchas in a z3c form 
     8---------------------- 
     9 
     10Using quintagroup.z3cform.captcha in a z3c.form form is simple. 
     11Just add a Captcha field to your schema, use CaptchaWidgetFactory 
     12widget factory for this field and away you go: 
     13 
     14  >>> from zope.interface import Interface 
     15  >>> from z3c.form import form, field 
     16  >>> from quintagroup.z3cform.captcha import Captcha 
     17  >>> from quintagroup.z3cform.captcha import CaptchaWidgetFactory 
     18 
     19Now define form schema with Captch field  
     20 
     21  >>> class ICaptchaSchema(Interface): 
     22  ...     captcha = Captcha( 
     23  ...         title=_(u'Type the code'), 
     24  ...         description=_(u'Type the code from the picture shown below.')) 
     25 
     26And set proper widget factory for the captcha field 
     27 
     28  >>>  class CaptchaForm(form.Form): 
     29  ...      fields = field.Fields(ICaptchaSchema) 
     30  ...      fields['captcha'].widgetFactory = CaptchaWidgetFactory 
     31 
     32 
     33and z3c.form will take care of the rest. The widget associated with this field  
     34will render the captcha and verify the use input automatically. 
    635 
    736Supported Plone versions 
Note: See TracChangeset for help on using the changeset viewer.