Ver Mensaje Individual
  #12 (permalink)  
Antiguo 01/04/2011, 14:33
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

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

Saludos.