views:

80

answers:

2

Hello everyone,

Recently I tried zend framework (the quickstart project) :) and I really liked it.

All the frameworks (zend, cakephp) implements a very nice way of form fields validation. Moreover these validations are so easy to implement that you only have to give the name of the validation that you want to apply.

Like this:


        $this->addElement('text', 'email', array(
        'label'      => 'Your email address:',
        'required'   => true,
        'filters'    => array('StringTrim'),
        'validators' => array(
        'EmailAddress',
        )));

Also if any of the input is typed against the validation criteria and submitted, then the remaining form fields values are not cleared at all and proper message is displayed.

This made me think that how shall I create a system similar to this validation criteria. So that it can be easily embedded into a web application which has not been build using the framework.

Ofcourse I can do this in PHP (checking every posted value using functions or classes) but I want to do it the smarter and effecient way just like these frameworks have done.

So does any one know of any library for PHP which is able to do such validations quite smartly.

I hope I am able to explain my doubt clearly. Any help is greatly appreciated.

Thanks

+1  A: 

Why don't you just include the Zend_Form_Validation library. The idea of ZF is that you can load any libraries you want, you don't have to go through a bootstrap process to use the framework. Just include it and use it.

Laykes
have you tried it, or just saying it because of the fact that zend's components are loosely coupled.?
Gaurav Sharma
Well I know that it is possible. I have been using Zend Framework since 1.5. However, I do not use Zend_Form, but every library in the framework is intended to be used in any application, whether or not it uses ZF or not. (There are obvious exceptions for people who take this post too literally).
Laykes
Yeas, that depends whether you want to use this library or not. Actually I was looking for libraries other than zend's (that works like zend) but will definitely try your solution.thanks
Gaurav Sharma
+1  A: 

HTML_QuickForm

ya.teck
Hi chi,did you checked the link by yourself before posting it.? It is not working, (404 error)
Gaurav Sharma
Thanks. I corrected the link.
ya.teck