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

    <bdo id='7wVps'></bdo><ul id='7wVps'></ul>
<tfoot id='7wVps'></tfoot>
  • <legend id='7wVps'><style id='7wVps'><dir id='7wVps'><q id='7wVps'></q></dir></style></legend>
  • <small id='7wVps'></small><noframes id='7wVps'>

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

        在 Zend_Form 中,如何避免 Zend_Validate_Email 產生多個

        In a Zend_Form, how to avoid Zend_Validate_Email from generating multiple errors?(在 Zend_Form 中,如何避免 Zend_Validate_Email 產生多個錯誤?)
        • <small id='uOKvB'></small><noframes id='uOKvB'>

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

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

              <legend id='uOKvB'><style id='uOKvB'><dir id='uOKvB'><q id='uOKvB'></q></dir></style></legend>
                  <tbody id='uOKvB'></tbody>

                1. 本文介紹了在 Zend_Form 中,如何避免 Zend_Validate_Email 產生多個錯誤?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在構建一個 ZendFramework 應用程序,它作為一個要求輸入電子郵件地址和密碼的登錄表單 - 在嘗試登錄數據庫之前驗證電子郵件地址似乎是有意義的,因為無效的電子郵件永遠不會導致有效命中.Zend_Validate_EmailAddress 似乎是正確的方法,但我遇到了一個問題,它會產生多個錯誤(底部的問題,代碼之后).

                  I am building a ZendFramework application which as a login form asking for an email address and password - it seemed to make sense to validate the email address before hitting the database with the login attempt, as an invalid email would never lead to a valid hit. Zend_Validate_EmailAddress seemed like the right way to go, but I am having an issue with it generating multiple errors (question at the bottom, after the code).

                  我的表單目前有以下內容

                  My form currently has the following

                  //WPMail_Form_Login::init()
                  $email = $this->addElement('text', 'email', array(
                      'label'=>'Email',
                      'required'=>true,
                      'filters'=>array('stringtrim'),
                      'validators'=>array(array('emailaddress', true, array(
                          'messages'=>array(
                              'emailAddressInvalidHostname'=>'Your email address is invalid',
                              'emailAddressInvalidFormat'=>'Your email address is invalid',
                              '...'=>'(repeat for all message templates)'
                          )
                      ))),
                  ));
                  

                  在控制器中,我直接將表單傳遞到視圖中:

                  In the controller I directly pass the form into the view:

                  // WPMail_AuthController::loginAction()
                  $this->view->form = $form;
                  

                  在視圖中,它是直接回顯的:

                  And in the view, it's directly echo'd:

                  // views/scripts/auth/login.phtml
                  <?php echo $this->form ?>
                  

                  目前的結果是這樣的:

                  - Your email address is invalid
                  - 'asda!!!' does not match the expected structure for a DNS hostname
                  - 'asda!!!' does not appear to be a valid local network name
                  

                  我想知道的是:是否可以將 Zend_Validate_EmailAddress 配置為只產生一個電子郵件無效錯誤?我所說的配置"是指不擴展類并用我自己的邏輯覆蓋邏輯.

                  What I want want to know is: Is it possible to configure Zend_Validate_EmailAddress in such a way that it only produces a single email-invalid error? By 'configure' I mean, without extending the class and overriding the logic with my own.

                  TIA.

                  推薦答案

                  Zend Form Element 有多種方法可用于自定義消息.從文檔中并不是很清楚,但是 addErrorMessage() 會在驗證失敗時設置一條自定義錯誤消息.

                  Zend Form Element has various methods you can use to customise messages . It's not terribly clear from the docs but addErrorMessage() sets a single custom error message on failed validation.

                  因此,您的示例如下所示:

                  Your example would therefore look like:

                  $email = new Zend_Form_Element_Text('email');
                  $email->setLabel('Email')
                        ->setRequired(true)
                        ->addFilter('stringtrim')
                        ->addValidator('emailAddress', true)
                        ->addErrorMessage('Your email address is invalid');
                  $this->addElement($email);
                  

                  參見 http:///framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.validators.errors

                  這篇關于在 Zend_Form 中,如何避免 Zend_Validate_Email 產生多個錯誤?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 找不到驅動程序)
                  <i id='d3MCi'><tr id='d3MCi'><dt id='d3MCi'><q id='d3MCi'><span id='d3MCi'><b id='d3MCi'><form id='d3MCi'><ins id='d3MCi'></ins><ul id='d3MCi'></ul><sub id='d3MCi'></sub></form><legend id='d3MCi'></legend><bdo id='d3MCi'><pre id='d3MCi'><center id='d3MCi'></center></pre></bdo></b><th id='d3MCi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='d3MCi'><tfoot id='d3MCi'></tfoot><dl id='d3MCi'><fieldset id='d3MCi'></fieldset></dl></div>

                  <legend id='d3MCi'><style id='d3MCi'><dir id='d3MCi'><q id='d3MCi'></q></dir></style></legend>
                  1. <small id='d3MCi'></small><noframes id='d3MCi'>

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

                        • <bdo id='d3MCi'></bdo><ul id='d3MCi'></ul>
                          1. 主站蜘蛛池模板: 一区二区视频在线观看 | 91视频大全 | 国产高清视频 | 日韩成人在线视频 | 国产97在线 | 日韩 | 成人精品一区 | 亚洲日韩中文字幕一区 | 欧美 日韩 国产 在线 | 亚洲国产精选 | 国产91丝袜在线播放 | 在线黄色网| 99久久婷婷国产综合精品电影 | 日本成人午夜影院 | 4hu最新网址 | 91亚洲国产成人久久精品网站 | 日本黄色大片免费看 | 成人在线影视 | 成人在线 | 日韩精品一区二区三区免费视频 | 日本免费在线观看视频 | 国产免费观看视频 | 精品久久久网站 | 精品国产欧美 | 精品国产乱码久久久久久丨区2区 | 亚洲精品高清视频 | 亚洲精品日韩在线观看 | 亚洲一区| 久久九七| 在线一区二区三区 | 色综合99| 一级黄色录像片子 | 日韩激情在线 | 香蕉一区| 成人免费激情视频 | 亚洲a视频| 成人aaa视频 | 午夜精品久久久久99蜜 | 这里只有精品99re | 国产一区二区三区久久久久久久久 | 精久久| 自拍偷拍av|