$email = new Zend_Form_Element_Text('email'); $email->setLabel('Email') ->addFilter('StringTrim') ->addValidator('EmailAddress');
$phone = new Zend_Form_Element_Text('phone'); $phone->setLabel('Phone number') ->addFilter('StringTrim') ->addValidator('Digits') ->addValidator('StringLength', false, array(10, 15));In this example, we create a text input element for the user's phone number. We add a label to describe the input, trim any whitespace from the user's entry, and validate that the input contains only digits. We also validate that the phone number is between 10 and 15 characters in length. The Zend_Form_Element_Text class is part of the Zend_Form package library.