Validate package API proposal

From: Date: Sun, 16 Feb 2003 17:52:36 +0000
Subject: Validate package API proposal
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13378@lists.php.net to get a copy of this message
Hi Pierre, The Validate package could be used with QuickForm to validate form data. At the moment, QuickForm can use it successfully, but because the Validate methods API is always different from one method to another, there are only a small number of methods that QuickForm can work with. For example, function ssn($number) is ok because it accepts one parameter but function rib($aCodeBanque, $aCodeGuichet, $aNoCompte, $aKey) can't work. The QuickForm API for rules is parameter1: the value to validate, parameter2: the options (or a default value). So, if, instead of using function rib($aCodeBanque, $aCodeGuichet, $aNoCompte, $aKey), you use an array with 4 keys as first parameter, that would make it easy for QuickForm users to use the Validate package. In summary, I would suggest that you use functionName($valuesToTest, $optionsForValidation) as a common access to all validation functions. Let me know if you think this change is possible. I am not sure making yet another abstraction layer to Validate in QuickForm is the best solution. TIA Bertrand Mansion Mamasam

« previous php.pear.dev (#13378) next »