pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <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="ceemawm" 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 個(gè)字段是否相同

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

            <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="vljxnlt" id='RyS4y'><tfoot id='RyS4y'></tfoot><dl id='RyS4y'><fieldset id='RyS4y'></fieldset></dl></div>
                • 本文介紹了Zend_Form:如何檢查 2 個(gè)字段是否相同的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

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

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

                  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?

                  這是我的兩個(gè)密碼字段的代碼:

                  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());
                  

                  推薦答案

                  當(dāng)我在尋找相同的東西時(shí),我發(fā)現(xiàn)這個(gè)非常有效的通用 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;
                    }
                  }
                  ?>
                  

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

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

                  相關(guān)文檔推薦

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

                  <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="dhd1lt5" 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>
                          • 主站蜘蛛池模板: 临海涌泉蜜桔官网|涌泉蜜桔微商批发代理|涌泉蜜桔供应链|涌泉蜜桔一件代发 | 培训中心-海南香蕉蛋糕加盟店技术翰香原中心官网总部 | 苏州注册公司_苏州代理记账_苏州工商注册_苏州代办公司-恒佳财税 | 广州食堂承包_广州团餐配送_广州堂食餐饮服务公司 - 旺记餐饮 | 氧化锆陶瓷_氧化锆陶瓷加工_氧化锆陶瓷生产厂家-康柏工业陶瓷有限公司 | 洁净化验室净化工程_成都实验室装修设计施工_四川华锐净化公司 | 超声波清洗机_超声波清洗机设备_超声波清洗机厂家_鼎泰恒胜 | 环氧树脂地坪_防静电地坪漆_环氧地坪漆涂料厂家-地壹涂料地坪漆 环球电气之家-中国专业电气电子产品行业服务网站! | 耐驰泵阀管件制造-耐驰泵阀科技(天津)有限公司 | 工业PH计|工业ph酸度计|在线PH计价格-合肥卓尔仪器仪表有限公司 济南画室培训-美术高考培训-山东艺霖艺术培训画室 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 脉冲除尘器,除尘器厂家-淄博机械| 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 高空重型升降平台_高空液压举升平台_高空作业平台_移动式升降机-河南华鹰机械设备有限公司 | 月嫂_保姆_育婴_催乳_母婴护理_产后康复_养老护理-吉祥到家家政 硫酸亚铁-聚合硫酸铁-除氟除磷剂-复合碳源-污水处理药剂厂家—长隆科技 | 巩义市科瑞仪器有限公司| 密集柜_档案密集柜_智能密集架_密集柜厂家_密集架价格-智英伟业 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 保定市泰宏机械制造厂-河北铸件厂-铸造厂-铸件加工-河北大件加工 | 哈希PC1R1A,哈希CA9300,哈希SC4500-上海鑫嵩实业有限公司 | 工业冷却塔维修厂家_方形不锈钢工业凉水塔维修改造方案-广东康明节能空调有限公司 | 砖机托板价格|免烧砖托板|空心砖托板厂家_山东宏升砖机托板厂 | 英思科GTD-3000EX(美国英思科气体检测仪MX4MX6)百科-北京嘉华众信科技有限公司 | 超声波乳化机-超声波分散机|仪-超声波萃取仪-超声波均质机-精浩机械|首页 | 电缆接头_防水接头_电缆防水接头_防水电缆接头_上海闵彬 | 翰墨AI智能写作助手官网_人工智能问答在线AI写作免费一键生成 | wika威卡压力表-wika压力变送器-德国wika代理-威卡总代-北京博朗宁科技 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | 玉米深加工设备-玉米深加工机械-新型玉米工机械生产厂家-河南粮院机械制造有限公司 | PVC快速门-硬质快速门-洁净室快速门品牌厂家-苏州西朗门业 | 通信天线厂家_室分八木天线_对数周期天线_天线加工厂_林创天线源头厂家 | 不锈钢/气体/液体玻璃转子流量计(防腐,选型,规格)-常州天晟热工仪表有限公司【官网】 | 骨灰存放架|骨灰盒寄存架|骨灰架厂家|智慧殡葬|公墓陵园管理系统|网上祭奠|告别厅智能化-厦门慈愿科技 | 有福网(yofus.com)洗照片冲印,毕业聚会纪念册相册制作个性DIY平台 | 高柔性拖链电缆-聚氨酯卷筒电缆-柔性屏蔽电缆厂家-玖泰电缆 | 仿清水混凝土_清水混凝土装修_施工_修饰_保护剂_修补_清水混凝土修复-德州忠岭建筑装饰工程 | 雄松华章(广州华章MBA)官网-专注MBA/MPA/MPAcc/MEM辅导培训 | 微型驱动系统解决方案-深圳市兆威机电股份有限公司 | 冷镦机-多工位冷镦机-高速冷镦机厂家-温州金诺机械设备制造有限公司 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | WF2户外三防照明配电箱-BXD8050防爆防腐配电箱-浙江沃川防爆电气有限公司 | hc22_hc22价格_hc22哈氏合金—东锜特殊钢 |