当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form::isErrors方法代码示例

本文整理汇总了PHP中Zend_Form::isErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::isErrors方法的具体用法?PHP Zend_Form::isErrors怎么用?PHP Zend_Form::isErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form的用法示例。


在下文中一共展示了Zend_Form::isErrors方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testShouldAllowPushingErrorsOntoErrorStackWithErrorMessages

 public function testShouldAllowPushingErrorsOntoErrorStackWithErrorMessages()
 {
     $this->assertFalse($this->form->isErrors());
     $this->form->setErrors(array('Error 1', 'Error 2'))->addError('Error 3')->addErrors(array('Error 4', 'Error 5'));
     $this->assertTrue($this->form->isErrors());
     $messages = $this->form->getMessages();
     $this->assertEquals(5, count($messages));
     foreach (range(1, 5) as $id) {
         $message = 'Error ' . $id;
         $this->assertContains($message, $messages);
     }
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:12,代码来源:FormTest.php

示例2: validateForm

    /**
     * Faz a validação do formulário de usergroup (usado pelo Admin)
     * 
     * @param Nidorx_Form $form
     * @param Array $data 
     */
    public function validateForm(Zend_Form $form, $data)
    {

        if ($form->isValid($data)) {

            $translator = new Nidorx_Translator();

            $username = $form->getElement('username')->getValue();
            if ($this->_daoUser->getByUsername($username)) {
                $form->getElement('username')->addError($translator->translate('error_username_in_use'));
                $form->addError($translator->translate('error_username_in_use'));
            }

            //Verificando se o email já está em uso
            $email = $form->getElement('email')->getValue();
            if ($this->_daoUser->getByEmail($email)) {
                $form->getElement('email')->addError($translator->translate('error_email_in_use'));
                $form->addError($translator->translate('error_email_in_use'));
            }
        };

        return!$form->isErrors();
    }
开发者ID:nidorx,项目名称:Zend_Dao_Vo,代码行数:29,代码来源:Create.php

示例3: prepareConfigElement

 /**
  * Remove cookie.jar if configs change and convert form password to password element
  * @param string $section
  * @param string $namespace
  * @param unknown_type $key
  * @param Zend_Form_Element $element
  * @param Zend_Form $form
  * @param Zend_Controller_Action $controller
  */
 public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
 {
     // nothing to do if this isn't the right section
     if ($namespace != $this->getId()) {
         return;
     }
     // remove cookie.jar if somethings has value
     if (!$form->isErrors() && !is_null($element->getValue())) {
         $this->clearLastCheck();
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:20,代码来源:UpdateNotifier.php

示例4: _recurseForm

 /**
  * Recurse through a form object, rendering errors
  *
  * @param  \Zend_Form $form
  * @param  \Zend_View_Interface $view
  * @return string
  */
 protected function _recurseForm(\Zend_Form $form)
 {
     $subFormsWithErrors = array();
     $subFormMessages = array();
     $tabId = 0;
     foreach ($form->getSubForms() as $subForm) {
         if ($subForm instanceof \Gems_Form_TabSubForm) {
             // See if any of the subformelements has an error message
             foreach ($subForm->getElements() as $subFormElement) {
                 $elementMessages = $subFormElement->getMessages();
                 if (count($elementMessages)) {
                     $subFormsWithErrors[$tabId] = $subForm->getAttrib('title');
                     // Save subform title
                     $subForm->setAttrib('jQueryParams', array('class' => 'taberror'));
                     // Add css class to the subform
                     $form->selectTab($tabId);
                     // Select the tab, this way the last tab with error is always selected
                     break;
                     // don't check other elements
                 }
             }
             // Preserve subform level custom messages if we have an error
             if (array_key_exists($tabId, $subFormsWithErrors)) {
                 $subFormMessages[$tabId] = $subForm->getCustomMessages();
             }
             $tabId++;
         }
     }
     // If we found at least one error, and 'verbose' is true
     if ($this->getVerbose() && (!empty($subFormsWithErrors) || $form->isErrors())) {
         // First show form level custom error messages (the elements show their own errors)
         $formMessage = $form->getCustomMessages();
         if (!empty($formMessage)) {
             foreach ($formMessage as $message) {
                 \Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage($message);
             }
         }
         // Now browse through the tabs with errors
         foreach ($subFormsWithErrors as $tabIdx => $tabName) {
             // If more then one tab, show in which tab we found the errors
             if ($tabId > 1) {
                 $translator = \Zend_Registry::get('Zend_Translate');
                 \Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage(sprintf($translator->_('Error in tab "%s"'), $tabName));
             }
             // If we have them, show the tab custom error messages
             foreach ($subFormMessages[$tabIdx] as $subFormMessage) {
                 foreach ($subFormMessage as $message) {
                     \Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage("--> " . $message);
                 }
             }
         }
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:60,代码来源:TabErrors.php

示例5: prepareConfigElement

 /**
  * Remove cookie.jar if configs change and convert form password to password element
  * @param string $section
  * @param string $namespace
  * @param unknown_type $key
  * @param Zend_Form_Element $element
  * @param Zend_Form $form
  * @param Zend_Controller_Action $controller
  */
 public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
 {
     // nothing to do if this isn't the right section
     if ($namespace != $this->getId()) {
         return;
     }
     switch ($key) {
         // i have to convert it to a password element
         case 'plugins_megavideo_premium_password':
             $password = $form->createElement('password', 'plugins_megavideo_premium_password', array('label' => $element->getLabel(), 'description' => $element->getDescription(), 'renderPassword' => true));
             $form->plugins_megavideo_premium_password = $password;
             break;
     }
     // remove cookie.jar if somethings has value
     if (!$form->isErrors() && !is_null($element->getValue()) && file_exists(APPLICATION_PATH . '/../data/megavideo/cookie.jar')) {
         if (@(!unlink(APPLICATION_PATH . '/../data/megavideo/cookie.jar'))) {
             X_Debug::e("Error removing cookie.jar");
         }
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:29,代码来源:Megavideo.php

示例6: testDeprecatedIsErrorsProxiesToHasErrors

 /**
  * @group ZF-9914
  */
 public function testDeprecatedIsErrorsProxiesToHasErrors()
 {
     $this->testCanValidateFullFormContainingOnlyElements();
     $this->assertEquals($this->form->isErrors(), $this->form->hasErrors());
 }
开发者ID:baofeng-beijing,项目名称:zf1.11.x,代码行数:8,代码来源:FormTest.php

示例7: prepareConfigElement

 /**
  * Convert form password to password element
  * @param string $section
  * @param string $namespace
  * @param unknown_type $key
  * @param Zend_Form_Element $element
  * @param Zend_Form $form
  * @param Zend_Controller_Action $controller
  */
 public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
 {
     // nothing to do if this isn't the right section
     if ($namespace != $this->getId()) {
         return;
     }
     switch ($key) {
         // i have to convert it to a password element
         case 'plugins_rapidshare_premium_password':
             $password = $form->createElement('password', 'plugins_rapidshare_premium_password', array('label' => $element->getLabel(), 'description' => $element->getDescription(), 'renderPassword' => true));
             $form->plugins_rapidshare_premium_password = $password;
             break;
     }
     // remove cookie if somethings has value
     if (!$form->isErrors() && !is_null($element->getValue()) && ($key = 'plugins_rapidshare_premium_password')) {
         // clean cookies
         try {
             X_Debug::i("Cleaning up cookies in cache");
             /* @var $cacheHelper X_VlcShares_Plugins_Helper_Cache */
             $cacheHelper = X_VlcShares_Plugins::helpers()->helper('cache');
             try {
                 $cacheHelper->retrieveItem("rapidshare::cookie");
                 // set expire date to now!
                 $cacheHelper->storeItem("rapidshare::cookie", '', 0);
             } catch (Exception $e) {
                 // nothing to do
             }
             try {
                 $cacheHelper->retrieveItem("rapidshare::lastreloginflag");
                 // set expire date to now!
                 $cacheHelper->storeItem("realdebrid::lastreloginflag", '', 0);
             } catch (Exception $e) {
                 // nothing to do
             }
         } catch (Exception $e) {
             X_Debug::w("Cache plugin disabled? O_o");
         }
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:48,代码来源:RapidShare.php


注:本文中的Zend_Form::isErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。