久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='muaj5'><tr id='muaj5'><dt id='muaj5'><q id='muaj5'><span id='muaj5'><b id='muaj5'><form id='muaj5'><ins id='muaj5'></ins><ul id='muaj5'></ul><sub id='muaj5'></sub></form><legend id='muaj5'></legend><bdo id='muaj5'><pre id='muaj5'><center id='muaj5'></center></pre></bdo></b><th id='muaj5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='muaj5'><tfoot id='muaj5'></tfoot><dl id='muaj5'><fieldset id='muaj5'></fieldset></dl></div>

    <small id='muaj5'></small><noframes id='muaj5'>

    1. <legend id='muaj5'><style id='muaj5'><dir id='muaj5'><q id='muaj5'></q></dir></style></legend>
      <tfoot id='muaj5'></tfoot>

        <bdo id='muaj5'></bdo><ul id='muaj5'></ul>

      1. Zend_Form:如何檢查 2 個字段是否相同

        Zend_Form: how to check 2 fields are identical(Zend_Form:如何檢查 2 個字段是否相同)

            <bdo id='RyS4y'></bdo><ul id='RyS4y'></ul>

                <legend id='RyS4y'><style id='RyS4y'><dir id='RyS4y'><q id='RyS4y'></q></dir></style></legend>

                  <tbody id='RyS4y'></tbody>
                  <tfoot id='RyS4y'></tfoot>

                • <small id='RyS4y'></small><noframes id='RyS4y'>

                • <i id='RyS4y'><tr id='RyS4y'><dt id='RyS4y'><q id='RyS4y'><span id='RyS4y'><b id='RyS4y'><form id='RyS4y'><ins id='RyS4y'></ins><ul id='RyS4y'></ul><sub id='RyS4y'></sub></form><legend id='RyS4y'></legend><bdo id='RyS4y'><pre id='RyS4y'><center id='RyS4y'></center></pre></bdo></b><th id='RyS4y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RyS4y'><tfoot id='RyS4y'></tfoot><dl id='RyS4y'><fieldset id='RyS4y'></fieldset></dl></div>
                • 本文介紹了Zend_Form:如何檢查 2 個字段是否相同的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我創(chuàng)建了一個表單來將用戶添加到數(shù)據(jù)庫并使用戶可以登錄.

                  I have created a form to add a user to a database and make user available for login.

                  現(xiàn)在我有兩個密碼字段(第二個用于驗證第一個).如何向 zend_form 添加用于此類驗證的驗證器?

                  Now I have two password fields (the second is for validation of the first). How can I add a validator for this kind of validation to zend_form?

                  這是我的兩個密碼字段的代碼:

                  This is my code for the two password fields:

                      $password = new Zend_Form_Element_Password('password', array(
                          'validators'=> array(
                              'Alnum',
                              array('StringLength', array(6,20))
                              ),
                          'filters'   => array('StringTrim'),
                          'label'     => 'Wachtwoord:'
                          ));
                  
                      $password->addFilter(new Ivo_Filters_Sha1Filter());
                  
                      $password2 = new Zend_Form_Element_Password('password', array(
                          'validators'=> array(
                              'Alnum',
                              array('StringLength', array(6,20))
                              ),
                          'filters'   => array('StringTrim'),
                          'required'  => true,
                          'label'     => 'Wachtwoord:'
                          ));
                      $password2->addFilter(new Ivo_Filters_Sha1Filter());
                  

                  推薦答案

                  當我在尋找相同的東西時,我發(fā)現(xiàn)這個非常有效的通用 Validator for Identical Fields.我現(xiàn)在找不到它所以我只是發(fā)布代碼...

                  When I was looking for the same, I found this very well working generic Validator for Identical Fields. I don't find it now so I just post the code...

                  <?php
                  
                  class Zend_Validate_IdenticalField extends Zend_Validate_Abstract {
                    const NOT_MATCH = 'notMatch';
                    const MISSING_FIELD_NAME = 'missingFieldName';
                    const INVALID_FIELD_NAME = 'invalidFieldName';
                  
                    /**
                     * @var array
                    */
                    protected $_messageTemplates = array(
                      self::MISSING_FIELD_NAME  =>
                        'DEVELOPMENT ERROR: Field name to match against was not provided.',
                      self::INVALID_FIELD_NAME  =>
                        'DEVELOPMENT ERROR: The field "%fieldName%" was not provided to match against.',
                      self::NOT_MATCH =>
                        'Does not match %fieldTitle%.'
                    );
                  
                    /**
                     * @var array
                    */
                    protected $_messageVariables = array(
                      'fieldName' => '_fieldName',
                      'fieldTitle' => '_fieldTitle'
                    );
                  
                    /**
                     * Name of the field as it appear in the $context array.
                     *
                     * @var string
                     */
                    protected $_fieldName;
                  
                    /**
                     * Title of the field to display in an error message.
                     *
                     * If evaluates to false then will be set to $this->_fieldName.
                     *
                     * @var string
                    */
                    protected $_fieldTitle;
                  
                    /**
                     * Sets validator options
                     *
                     * @param  string $fieldName
                     * @param  string $fieldTitle
                     * @return void
                    */
                    public function __construct($fieldName, $fieldTitle = null) {
                      $this->setFieldName($fieldName);
                      $this->setFieldTitle($fieldTitle);
                    }
                  
                    /**
                     * Returns the field name.
                     *
                     * @return string
                    */
                    public function getFieldName() {
                      return $this->_fieldName;
                    }
                  
                    /**
                     * Sets the field name.
                     *
                     * @param  string $fieldName
                     * @return Zend_Validate_IdenticalField Provides a fluent interface
                    */
                    public function setFieldName($fieldName) {
                      $this->_fieldName = $fieldName;
                      return $this;
                    }
                  
                    /**
                     * Returns the field title.
                     *
                     * @return integer
                    */
                    public function getFieldTitle() {
                      return $this->_fieldTitle;
                    }
                  
                    /**
                     * Sets the field title.
                     *
                     * @param  string:null $fieldTitle
                     * @return Zend_Validate_IdenticalField Provides a fluent interface
                    */
                    public function setFieldTitle($fieldTitle = null) {
                      $this->_fieldTitle = $fieldTitle ? $fieldTitle : $this->_fieldName;
                      return $this;
                    }
                  
                    /**
                     * Defined by Zend_Validate_Interface
                     *
                     * Returns true if and only if a field name has been set, the field name is available in the
                     * context, and the value of that field name matches the provided value.
                     *
                     * @param  string $value
                     *
                     * @return boolean 
                    */ 
                    public function isValid($value, $context = null) {
                      $this->_setValue($value);
                      $field = $this->getFieldName();
                  
                      if (empty($field)) {
                        $this->_error(self::MISSING_FIELD_NAME);
                        return false;
                      } elseif (!isset($context[$field])) {
                        $this->_error(self::INVALID_FIELD_NAME);
                        return false;
                      } elseif (is_array($context)) {
                        if ($value == $context[$field]) {
                          return true;
                        }
                      } elseif (is_string($context) && ($value == $context)) {
                        return true;
                      }
                      $this->_error(self::NOT_MATCH);
                      return false;
                    }
                  }
                  ?>
                  

                  這篇關于Zend_Form:如何檢查 2 個字段是否相同的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                  <i id='JoLBO'><tr id='JoLBO'><dt id='JoLBO'><q id='JoLBO'><span id='JoLBO'><b id='JoLBO'><form id='JoLBO'><ins id='JoLBO'></ins><ul id='JoLBO'></ul><sub id='JoLBO'></sub></form><legend id='JoLBO'></legend><bdo id='JoLBO'><pre id='JoLBO'><center id='JoLBO'></center></pre></bdo></b><th id='JoLBO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JoLBO'><tfoot id='JoLBO'></tfoot><dl id='JoLBO'><fieldset id='JoLBO'></fieldset></dl></div>

                  1. <small id='JoLBO'></small><noframes id='JoLBO'>

                        <bdo id='JoLBO'></bdo><ul id='JoLBO'></ul>

                        <tfoot id='JoLBO'></tfoot>

                          <tbody id='JoLBO'></tbody>

                          • <legend id='JoLBO'><style id='JoLBO'><dir id='JoLBO'><q id='JoLBO'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 成人免费视频网 | 日本a∨精品中文字幕在线 亚洲91视频 | 国产精品欧美一区二区三区不卡 | 久久精品a级毛片 | 亚洲精品一区二区三区蜜桃久 | 欧美一级毛片久久99精品蜜桃 | 国产一区二区不卡 | 一本一道久久a久久精品蜜桃 | 国产日产久久高清欧美一区 | 91亚洲欧美 | 亚洲人人| 久久久久国产精品一区 | 国产中文字幕网 | 综合色播 | 狠狠综合网| 欧美一区二区成人 | 97综合在线 | 天堂中文av | 久久精品日产第一区二区三区 | 影音先锋成人资源 | 欧美日韩一区在线 | 91在线精品一区二区 | 羞羞视频在线网站观看 | 琪琪午夜伦伦电影福利片 | 欧美亚洲视频 | 国产精品99久久久久久久久 | 亚洲a视频 | 欧美日韩不卡合集视频 | 欧美精品综合在线 | 国产精品夜色一区二区三区 | 免费看片在线播放 | 亚洲欧美中文日韩在线v日本 | 亚洲高清视频在线观看 | av色在线 | 欧美日韩在线一区 | 日韩av黄色| 日韩欧美国产一区二区 | 日韩视频a | 影音先锋欧美资源 | 狠狠干狠狠操 | av色站|