I have a class that extends Zend_Form_Subform. In init() I do this:

        $phone = new Zend_Form_Element_Text(
            array('name' => 'office_phone','id'
=>'person_office_phone','label' => 'Office phone',
            'belongsTo' => 'person' ,'class' => 'telephone'
            )
        );
        $phone->addValidator('StringLength',true,array('min'=>10,'max'=>10,
            'messages' =>     array(
                 Zend_Validate_StringLength::TOO_SHORT => $m = "phone number
must be 10 digits",
                Zend_Validate_StringLength::TOO_LONG => $m
        )));
        $phone->addFilter(new Zend_Filter_Digits());
        $this->addElement($phone);

I have a Zend_Form subclass that contains two subforms, the above being one
of them.

In this case I am trying to strip non-digits form a 10-digit phone number.
When I POST the form with
"212 805-0362" in this field, validation is failing.

Crude but effective, I put echo statements in Zend_Filter_Digits constructor
and filter() method, and determined that the Zend_Filter_Digits instance is
created, but the filter() method is never executed.

Pray tell, what I am doing wrong? Or have I discovered a bug?

This is ZF 1.10.0. Any guidance is deeply appreciated.


-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/

Reply via email to