Related Entries

Interview with Ploners
Server side python
Resetting Zope's session timeout
Getting undo history
Plone roles on

« Ironic, is it not?
» Friday morning links

Formulator makes life easy

It also makes for very quick solutions. Thank you Martijn Faassen.

I had made various notes to self to look into Formulator for Zope, over the last year. Never got around to it till now.

According to the author “Formulator is an extensible framework that eases the creation and validation of web forms”.

Very nice. With two small Python scripts and a PageTemplate, I could make a system for making web databases - ok, think of it like a spreadsheet, or a database with just one table. I can see enormous uses for this, mainly for making quickly sharable datasets on the web.

Idea is like this. Here's how to design a dataset.

Since users never design “databases”, it has to be easy for them. Most users can visualize forms.

As far as normal users are considered, that's it. Use the form to enter data and hit save. It gets saved. When they navigate to saved record, form is again displayed with saved data automatically pre-filled in the fields

The backend is very simple. Whenever a form save happens, a Zope folder is created to hold the data. All non-file data are saved in the property sheet of the folder. If I get time, and if there is a need, I'm planning to support file uploads too.

If the form save happens from inside a record folder, it merely updates the property sheets of that folder.

I chose a Folder as the object to store data - as opposed to say, a DTML Document - for couple of reasons. A container object supports uploading of files. If a record needs to have special processing, we can add appropriate objects there. Lastly, if records need to be accessible only for certain users, a User Folder inside the record folder solves the issue.

Total code I had to write so far has about 40 lines of Python Script. PageTemplate has around 5 useful lines, discounting the HTML and CSS. The whole thing took about 2 hours at home - including figuring out Formulator, deciding on what to use it for, and coding. These numbers are reasons good enough for me to ignore hype about “enterprise class scalable J2EE container blah blah architecture”.


  1. Add form validation errors right back on the form.
  2. Make navigation screens to navigate from record to record. I don't like frames, but I'm wondering if frames are a better choice here.
  3. Make simple catalog and search interface.
  4. Couple of scripts to download records as XML and CSV.

Beehive's MetaPublisher solves similar problems. But hey, I want to re-invent the wheel at times :-) Definitely, Formulator has a much larger user community and is actively maintained.

I'll probably not package this into a Zope product. If someone has similar needs and would like to get the code (and no support), drop me a comment.

Meanwhile, assuming you are on your own and won't need any support, download formulator_demo.zexp

  1. Hi Im a Sys Admin for and administer a number of domains .I have been given the task to create aweb form survey for one of my domains.

    I have a couple of DTML and a Formulator that Im toying with Please if possible can I have a look at and gey a copy of your code .

    Posted by: chuck on April 23, 2004 02:20 PM
  2. Hi,
    I have created a form using ZPT, this form sends an email , and shows a page confirming that the form has been filled. i want the content to be saved in the form of document in zodb, i am not showing these documents to any user, i want to keep these document for the record purpose.


    Posted by: Anita on May 11, 2004 06:32 PM
  3. Hi could you send me a copy of your code? We are working on a new Zope 2.6 / Plone 2 CMS for our website. I'd like to get formulator to work with Plone's UI and put submissions into a mysql db or the zodb. The forms will be user-created and submission data should be available only to the creator (and whoever else he/she allows).

    I have little experience with Zope, so I'm investigating any other implementations others may have involving formulator. Any help/suggestions would be much appreciated!


    Posted by: Daniel on June 3, 2004 01:15 AM
  4. Hi, I am planning to create a large site for newbies with forms and the idea of being able to store information in a database looks nice! Did anybody find a workaround that is not too difficult to implement (I am still learning).

    Posted by: manu on September 9, 2004 01:01 AM
  5. hi, i'm creating a web form with two or three pages for my university. my problem is right now how to save the data. i'm relativly new to zope, so i'm not sure how I create the objects. Your example with the Zope folder would be quite helpfull as there's a lack of examples with working source code in the web.

    Posted by: annette on October 22, 2004 05:05 PM