Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/04/2011, 09:59
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Agregar Filtro A Elemento Form

Puedes usar algo así:
Código PHP:
Ver original
  1. $form->addElement('text', 'phone', array(
  2.     'Label' => 'Teléfono',
  3.     'Description' => 'El teléfono debe contener código de área sin anteponer 0, ni 15 para celulares.',
  4.     'Validators' => array(
  5.         'Digits',
  6.         array('StringLength', false, array(10, 10))
  7.     ),
  8.     'Required' => false,
  9.     'Filters' => array(
  10.         array('Callback', function($value) {
  11.             return ltrim($value, '0');
  12.         })
  13.     )
  14. ));

Saludos.