[sf-perl] Favorite form validation modules?
moseley at hank.org
Wed Jan 6 20:52:17 PST 2010
On Wed, Jan 6, 2010 at 3:29 PM, Michael Friedman <
friedman at highwire.stanford.edu> wrote:
> Maybe it's my lack of front-end-web-rendering experience showing, but what
> kind of form validation are you doing?
> My office generally designs forms so that fields either don't need
> validation (a list of state abbreviations instead of a text box; a
> address formatting or credit card number formatting). That way the user gets
> immediate feedback and doesn't have to send the form to the server for
> validation. For things like full text search fields, we just throw the query
> at the full text search server and let it figure it out.
> I guess I don't understand why "form validation" is something you'd want a
> special perl module for.
In addition to what others have said about the importance of server side
validation, a form is typically made up of a collection of data -- and the
validation of it also depends on what's in the form itself. So, for me, I
encapsulate that into a form object.
It's a black box that works in two directions. One direction is taking user
data (often in an HTML form, but could be anything), validate the input, and
then if validated save to the data store. The other direction does the
opposite and takes values from a store and creates the external
representation. The simple example would be a DateTime object internally
and a set of values for year, month, day externally. A more complex form
might write to different database tables based on what input the form
Then in MVC the controller's job ends up being the traffic, eh, controller.
Request comes in and is passed to the form object and if validated and
successful redirect to the success page, if does not validate then show the
form with errors.
At least that's how I think of it...
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SanFrancisco-pm