Changes between Version 8 and Version 9 of quintagroup.z3cform.captcha


Ignore:
Timestamp:
Apr 29, 2010 9:20:13 AM (14 years ago)
Author:
olha
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • quintagroup.z3cform.captcha

    v8 v9  
    1111quintagroup.z3cform.captcha allows adding captcha to [http://pypi.python.org/pypi/z3c.form z3c.form]. As a result such forms are prevented from automatic submit. 
    1212 
     13== Captchas in a z3c form == 
     14 
     15Using quintagroup.z3cform.captcha in a z3c.form form is simple. Just add a Captcha field to your schema, use CaptchaWidgetFactory widget factory for this field and away you go: 
     16 
     17{{{ 
     18    >>> from zope.interface import Interface 
     19    >>> from z3c.form import form, field 
     20    >>> from quintagroup.z3cform.captcha import Captcha 
     21    >>> from quintagroup.z3cform.captcha import CaptchaWidgetFactory 
     22}}} 
     23 
     24Now define form schema with Captch field 
     25 
     26{{{ 
     27    >>> class ICaptchaSchema(Interface): 
     28    ...     captcha = Captcha( 
     29    ...         title=_(u'Type the code'), 
     30    ...         description=_(u'Type the code from the picture shown below.')) 
     31}}} 
     32 
     33And set proper widget factory for the captcha field 
     34 
     35{{{ 
     36    >>>  class CaptchaForm(form.Form): 
     37    ...      fields = field.Fields(ICaptchaSchema) 
     38    ...      fields['captcha'].widgetFactory = CaptchaWidgetFactory 
     39}}} 
     40 
     41and z3c.form will take care of the rest. The widget associated with this field will render the captcha and verify the use input automatically. 
     42 
     43 
    1344== Supported Plone Versions == 
    1445