Eric Berg wrote:
I see that there are a number of form validation libraries that purport to work with Catalyst. I've been using CGI::Formbuilder for years and have been relatively happy with it.

I need something for my new Catalyst app. I have already created my forms in my TT templates, but I need validation for most of the regular stuff, including zip codes, states, credit card info, etc.

You guys got any  recommendations?

Thanks.

Eric

Its not form specific, but currently I like using MooseX::Types and MooseX::Types::Structured for validation.

You can use these to declare validators in a declarational fashion for each data type you have, or use pre-defined ones for some common cases. For each type Foo, it provides an is_Foo function you can test inputs with.

With MooseX::Types::Structured in particular and its "Dict" type constructors, you can define a type to represent the form as a whole, so it will check you have all the right fields and their contents; that said, while using a "Dict" for the whole form will tell you if any field was done incorrectly, it alone won't say which field, so whether you might want to use it depends on how specific you want input error messages to be.

-- Darren Duncan

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to