Custom layout tutorial

custom layout tutorial Projects

PloneFormGen in a nutshell: it allows you to build forms through the web in Plone CMS. This artile presents general overview about basic elements and functionality.

Basics

Few things I like about that product:

  • Allows building simple and advanced forms very easily. No coding necessary.
  • Out of the box saves all data (in ZODB). Enables to view it, sort it or export as CSV.
  • Sends email confirmations.
  • Highly customizable. Non experienced users can use field attributes, advanced users can play with TAL.
  • It works on all versions of Plone from 2.1 to 3.1
  • Lots of documentation and tutorials. Great work Steve! and others.

What more could you possibly want? Probably nothing. But there is little one thing that is missing for me – search.

Fields

It supports all common form input fields/widgets. I’ve counted 16 of them. The most important are:

  • boolean field – renders as checkbox,
  • datetime field – widget that allows to select date and time,
  • file field – enables to upload a file,
  • integer/float field – fields that can validate if an input is an integer or float,
  • image field – improves usability of form with added images,
  • lines field – input with multiple lines,
  • multi selection field – enables to select one or many options,
  • password field – familiar input with all characters as asterisks,
  • string field – standard “input” field,
  • text/rich text field – first for simple text, and the other one can display WYSIWYG editor to type formatted text

It also allows grouping of fields and inserting static labels.

Actions

Actions that are performed after form is submitted are defined by ‘actions adapters’. Form can use one or many of them in defined order. Its very easy to use them. Just add one, configure and select which adapters the form should use. There are 3 core adapters:

  • mailer adapter – sends list of all form fields to given email. Email address can be predefined or taken from the form. We can create many mailer adapters (and others too). For example form can send one email to administrator and one to user who filled the form. It the latter case one will use TAL to get its email address from form field. Email has few editable elements: header, body, footer. Users familiar with TAL can even modify the whole Page Template.
  • save data adapter – saves the whole form to ZODB. User can then export it as CSV, or view in table with sortable columns. One issue I’ve found is that when we change the form and add/remove fields column headers may no longer correctly describe the data.
  • custom script adapter – developer can write a custom script that will process the form to do whatever he wants: save to a relational database, send as a XML package to external application, create account on Plone site and more.

After form is submitted and all adapters has executed user can see a ‘Thank You’ page. It displays list of all or selected fields and values. Also one can add custom prologue and epilogue.

Extensions

There are few products that extend PloneFormGen with additional capabilities:

  • Readonly FormGen String Field – allows to add Readonly String Field to the form.
  • PFGCaptchaField – provides an additional field for display and validation of captchas.
  • Salesforce PFG Adapter – custom Action Adapter that writes data to Salesforce. com
  • PFG Payment Field – provides a way to process payments without risking storage of sensitive billing information or interfering with the rest of the form.
  • There are some ideas to integrate PloneFormGen with GetPaid

But the real power lies in capability to change some behaviour using Python and TAL scripting. We can pre-populate fields with logged in user details , show/h >write custom validators , embed javascript . I remember from Steve’s talk at Plone Conference in Washington that we can even create chain of many forms to create multi page form.

Rate article
Plone and Zope developer
Add a comment