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


PHP Form::getErrors方法代码示例

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


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

示例1: FormError

 /**
  * Odeslání formuláře s Errory
  * @param Form $form
  */
 public function FormError(Form $form)
 {
     $json = new \stdClass();
     $json->result = "error";
     $json->message = implode("<br />", $form->getErrors());
     $json->notify = implode(",", $form->getErrors());
     $response = new JsonResponse($json);
     $this->getPresenter()->sendResponse($response);
 }
开发者ID:vipercz,项目名称:sandbox,代码行数:13,代码来源:BaseControl.php

示例2: quickPickFormError

 public function quickPickFormError(Form $form)
 {
     if ($form->hasErrors() && $this->presenter->isAjax()) {
         $errors = $form->getErrors();
         $error = array_shift($errors);
         $this->presenter->payload->error = true;
         $this->presenter->payload->message = $error;
         $this->presenter->sendPayload();
     }
 }
开发者ID:rostenkowski,项目名称:vstore,代码行数:10,代码来源:QuickPick.php

示例3: renderAllErrors

    public function renderAllErrors(UI\Form $form)
    {
        $html = '';
        foreach ($form->getErrors() as $error) {
            $html .= '<div class="alert alert-danger">
							<a class="close" data-dismiss="alert">×</a>' . $error . '
						</div>';
        }
        $errors = new Html();
        $errors->setHtml($html);
        return $errors;
    }
开发者ID:jirinapravnik,项目名称:common,代码行数:12,代码来源:Bs3FormRenderer.php

示例4: formError

 /**
  * Process form if error occurs.
  * @param  void
  */
 public function formError(Form $form)
 {
     $errors = $form->getErrors();
     foreach ($errors as $error) {
         $this->presenter->flashMessage($error, "error");
     }
     switch ($form->name) {
         case "formEdit":
             $this->handleEdit();
             break;
         case "formUpload":
             $this->handleUpload();
             break;
     }
 }
开发者ID:Repticus,项目名称:CorpGuide,代码行数:19,代码来源:Annex.php

示例5: validateAddArticleForm

 public function validateAddArticleForm(Form $form)
 {
     $values = (object) $form->getHttpData();
     if ($values->publishedAt == "later") {
         $later = DateTimeUtils::createDbDatetimeFormatFromDateParts($values->year, $values->month, $values->day, $values->hour, $values->minute, "0");
         $valid = DateTimeUtils::createDateTime(DateTimeUtils::DB_DATETIME_FORMAT, $later);
         if (!$valid) {
             $form->addError("Zadej prosím platné datum");
         }
     }
     if ($values->photoId == 0) {
         $form->addError("Vyber prosím fotografii ke článku.");
     }
     if (!isset($values->tagList)) {
         $tagList = null;
         $form->addError("Zadej prosím alespoň jeden tag ke článku.");
     } else {
         $tagList = new TagCollection();
         foreach ($values->tagList as $tag) {
             $tagList->addItem(TagService::create($tag));
         }
     }
     $articleId = $form->getPresenter()->getParameter("articleId");
     if (count($form->getErrors()) > 0) {
         if ($articleId) {
             $form->getPresenter()->actionEdit(null, $tagList, $values->photoId);
         } else {
             $form->getPresenter()->actionAdd($tagList, $values->photoId);
         }
     }
 }
开发者ID:jaromir92,项目名称:Sportwin,代码行数:31,代码来源:AddArticleForm.php

示例6: onFormError

 /**
  * @author Petr Besir Horacek <sirbesir@gmail.com>
  * @param \Nette\Application\UI\Form $form
  * @return boolean
  */
 public function onFormError(\Nette\Application\UI\Form $form)
 {
     $errors = $form->getErrors();
     foreach ($errors as $error) {
         if ($this->getToGlobalFlashes()) {
             $this->getPresenter()->flashMessage($error, 'error');
         } else {
             $this->flashMessage('Při odesílání zprávy došlo k neznámé chybě. Zkuste to prosím později.', 'error');
         }
     }
     return FALSE;
 }
开发者ID:besir,项目名称:besir.cz,代码行数:17,代码来源:contactMe.php


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