[Catalyst] Recommend methods for form handling

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Fri Jan 19 16:37:20 GMT 2007


Jim Spath scribbled on 1/17/07 12:09 PM:
> I was wondering what the current consensus among Catalyst users is 
> about what the best way to approach forms is?
> 

I used FormBuilder for previous applications (and liked it a lot). But in our current project we need more dynamicity, so most form handling has moved to Javascript+Ajax :

  - forms are generated by TT2 templates, but all fields are always empty
  - when needed, new form subsections may be added dynamically through Jemplate
  - all fields are named according to a dotted syntax (i.e. "mainObject.part.1.subpart.4.fieldName") that represents paths in a data tree of hashrefs and arrayrefs
  - initialisation of the form is done in Javascript : the initializer receives a JSON data tree and fills the relevant fields (takes care of doing the appropriate action if the field is a textbox, a collection of radio buttons, a select , etc.)
  - submission of the form is done through AJAX ; the server either returns OK or returns a tree of error messages, with the same paths as the data. In that case the Javascript code arranges to display errors next to the relevant portions of the page.

On the perl side, the most relevant components in this process are TT2, CGI::Expand and Data::Domain.
On the javascript side, we are building a form handling toolkit, on top of prototype.js. Not fully mature yet, but it should come out quite soon.

Laurent Dami
Conseiller en systèmes d'information
Palais de Justice - Etat de Genève
Case postale 3966
Place du Bourg-de-Four 3, 1211 Genève 3
+41 (22) 327 20 64 (direct), +41 (22) 327 20 37 (service)
http://cui.unige.ch/~dami







More information about the Catalyst mailing list