Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Form Validation and Untainting

by cbrandtbuffalo (Deacon)
on Feb 11, 2005 at 17:38 UTC ( [id://430187]=note: print w/replies, xml ) Need Help??


in reply to Form Validation and Untainting

We've suffered through various forms of custom validation and ad hoc is not the way you want to live. I've also recently started using Data::FormValidator and I think it's great. Here's why:
  • It's fairly mature. It's been around long enough that many features are there and they've encountered and solved enough problems;
  • I found the interface very clear and clean-cut, yet flexible in the right parts. You can play with the profile as much as you want before you check your data. You can also play with the data hash you pass. We seldom just pass the param hash. We usually tweak it first, and DFV doesn't care.
  • It clearly differentiates between filters and constraints. Filters let you reasonably massage data (i.e., remove a dash from a phone number) to be nice to your users. If the simple filters don't clean it up enough, the constraint fires errors.
  • You can easily define your own filters and constraints on your system in custom constraint modules.
  • You get plenty of info back on failed constraints so you can form an appropriate response for the user.
  • It standardizes your validation. You are using a standard module rather than ad hoc code. Plus it prevents you from stuffing other things into your validation steps.

It's simple to start using it, and so far we haven't expanded beyond its capabilities. It can even handle complex inter-form dependencies in the constraint model. So far, it gets two thumbs up from me.

Replies are listed 'Best First'.
Re^2: Form Validation and Untainting
by hakkr (Chaplain) on Feb 11, 2005 at 17:50 UTC
    This is maybe a bit outthere/overkill for small systems but it could save you some code logic and is portable.

    1. Define XML docs and XML schema for your all forms and use XSLT to generate your form pages.
    2. use XML::Xerces to validate user input against the schema

    Of course you are slightly restricted in what you can validate by the XML schema language

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://430187]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found