Ad

PHP Based Form Validation Helpers?

- 1 answer

From my time working with Ruby On rails, there is a couple different packaged/projects out there to manage both validation and error reporting in an extensible way.

Self-studying Python Pylons I just got introduced to HTMLFill which so far seems like an elegant solution to a common task of form validation.

I know both examples are features of Frameworks, or in the case of HTMLFill, intended to be part of a framework... still I don't remember seeing anything remotely as well polished in cakephp, code igniter, or even Zend framework. Am I missing something out there, or would it be worth while to attempt to imitate Python's HTMLFill in PHP5?

disclaimers: I've written Ajax based form validation systems that rely on embedding metadata like class="data-required data-email" and like but they've always seemed clunky to me.

I believe in the fat model philosophy of data validation, with the HTMLFill example above, I plan on packing my models with common HTMLFill schemes to each model, as is possible.

Links: HTMLFill - http://www.formencode.org/htmlfill.html#introduction

Ad

Answer

The Zend Framework has the Zend_Validate class, it provides you a basic set of validators, you have also the Zend_Filter_Input class for data filtering, validation and escaping.

I've also used Propel ORM Validation Framework to do validation at the model level.

You can also enforce validation at the client side level, I recommend you the jQuery Validation plugin, it works really good...

Ad
source: stackoverflow.com
Ad