Here I have a password field:
/*********************PASSWORD**********************/
        $password = new Zend_Form_Element_Password('password');
        $alnumValidator = new Zend_Validate_Alnum();
        $password   ->setRequired(true)
                    ->setLabel('Password:')
                    ->addFilter('StringToLower')
                    ->addValidator('alnum')
             开发者_开发问答       ->addValidator('regex', false, array('/^[a-z]+/'))
                    ->addValidator('stringLength',false,array(6,20));
        $this->addElement($password);
It automatically makes the control use stars instead of actual letters. Is there a date control somewhere in the Zend framework?
There is no DateTime element in the regular Zend_Form package. DateTime is not a standard HTML form element. However, the Zend_Dojo Form Elements, do have a DateTime element that provides a calendar drop-down for selecting a date, as well as client-side date validation and formatting:
  $form->addElement(
      'DateTextBox',
      'foo',
      array(
          'label'          => 'Date:',
          'required'       => true,
          'invalidMessage' => 'Invalid date specified.',
          'formatLength'   => 'long',
      )
  );
Refer to the reference guide on how to enable Dojo in your Zend Framework project.
There is also a DateTime element in the ZendX_JQuery package, but that's part of the Extras package and not of the standard ZF distribution.
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
 加载中,请稍侯......
      
精彩评论