Hi,
I'm not a symfony expert, but i think that you can do easy what you want,
creatin a new file of your own validator in /lib/validator/
For example you can create a file ThisIsMyValidator.class.php
That cointains a class that inherit the class of TextValidator (Not sure
about that i had used my own validator class inheriting the sfValidatorBase.
Example:
class sfValidatorCUIT extends sfValidatorBase
{
protected function configure($options = array(), $messages = array()) // In
this method you can configure the error messages by default and some
options.
{
$this->addMessage('cuit_invalido', 'El Cuit/Cuil "%value%" es
invalido');
$this->addMessage('cuit_incompleto', 'Error, los Cuit/Cuil tienen 11
numeros');
$this->addOption('max_length');
$this->addOption('min_length');
$this->setOption('empty_value', '');
}
protected function doClean($value) // The metod that validates , value it's
the value to validate
{
$cuit = (string) $value;
// Here much lines omited that do other stuff with $i variable
for ($i=0; $i < strlen($cuit); $i= $i +1) {
throw new sfValidatorError($this, 'cuit_invalido',
array('value' => $value)); // Here i launch the error
}
return cuit; // if all it's rigth i return this value
}
}
Hope this helps you
Nicolas
--
Nicolas G. Ardison
[email protected]
Antes de imprimir este mensaje, asegúrese de que es necesario. El medio
ambiente está en nuestras manos.
Before printing, think about the environment.
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en