in reply to HTML Form Validation

There area number of modules that do these things: HTML::FormFu, Form::Processor, CGI::AutoForm, CGI::FormBuilder, Data::FormValidator, ...

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: HTML Form Validation
by zerohero (Monk) on May 22, 2009 at 16:26 UTC

    Thanks, HTML::FormFu looks pretty good. It seems to make an attempt at separating the display from the logic. While it's a tad more complicated than the others, it seems to attempt to handle all of the things involved for an HTML form. I'll likely give this one a try.

    Some of the others are aimed at handling just the validation logic, and value transformation. Not a bad thing to handle, but the rendering requires quite a bit of thought too.

    CGI::FormBuilder seems pretty decent and is documented well. The one problem I had was the rigidity in the display area. Since you pass in CSS arguments to the form, it doesn't look like this is separated out nicely (i.e. you'd want CSS classes and then to control layout separately). Perhaps this is just a simple example, and one can separate things (this wasn't clear from the 10 min I looked at it).

      OK it seems that CGI::FormBuilder handles view/logic separation by relying on a templating engine, which seems like a good approach, rather than reinventing the wheel. The injected CSS looks like it's useful for those who want something quick.