Greetings all.

I am woring on a project that requires  validation of form data. I am very
happy with Zend_Validate. I do have some suggestions tho. I am sure that
some of these have been brought up before, and if so, I apologize.

My suggestion is to change how the validation receives it values. For
instance, you have an array as follows:

$aData = ('username' => 'someone', 'password' => 'somepass');

You could pass this array to Zend_Validata as follows:

$valid = new Zend_Validate($aData);

Now each validator could be changed to accept another parameter indicating
which element of the array the validator would validate. For example:

$valid->addValidator(new Zend_Validate_StringLength(8, 20), true,
'username');

This would validate the 'username' array element.

I think this could reduce the amount of code need to validate a form
considerably.

That is my suggestion. I hope it makes sense.

Regards, Troy L. Marker
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.17/661 - Release Date: 1/30/2007
11:30 PM

Reply via email to