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


PHP Form::setAction方法代码示例

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


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

示例1: createComponentLoginForm

 public function createComponentLoginForm()
 {
     $form = new \Nette\Application\UI\Form($this, 'loginForm');
     $form->addText('username', 'Jméno')->setRequired('Vložte Vaše uživatelské jméno.');
     $form->addPassword('password', 'Heslo')->setRequired('Zadejte prosím vaše heslo.');
     $form->addSubmit('send', 'Přihlásit');
     $form->setAction('#booking');
     return $form;
 }
开发者ID:ptacekj,项目名称:nette-mrdka,代码行数:9,代码来源:BasePresenter.php

示例2: createComponentForm

 protected function createComponentForm()
 {
     $form = new Form();
     $form->setAction('/');
     $form->addHidden('do', 'search-form-submit');
     $form->addText('query');
     $form->addSubmit('search');
     $form->onSuccess[] = $this->onSuccess;
     return $form;
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:10,代码来源:Search.php

示例3: createComponentSendMailForm

 public function createComponentSendMailForm()
 {
     $this->redrawControl('tellafriend');
     $form = new Nette\Application\UI\Form();
     $form->setAction('?');
     $form->addText('mailto', 'Mail to')->setAttribute('placeholder', 'od koho (e-mail)')->setRequired('Zadejte prosím platný e-mail')->setType('email')->addRule($form::EMAIL, 'Zadejte prosím platný e-mail');
     $form->addText('mailfrom', 'Mail from')->setAttribute('placeholder', 'komu (e-mail)')->setRequired('Zadejte prosím platný e-mail')->setType('email')->addRule($form::EMAIL, 'Zadejte prosím platný e-mail');
     $form->addSubmit('send', 'odeslat e-mail');
     $form->onSuccess[] = $this->sendEmail;
     return $form;
 }
开发者ID:jannovy,项目名称:tell-a-friend,代码行数:11,代码来源:TellAFriend.php

示例4: createComponentDatasourceColumnRenameDialog

 protected function createComponentDatasourceColumnRenameDialog()
 {
     $presenter = $this;
     $form = new Form();
     $form->setAction($this->link('getDatasourceColumnRenameDialog!'));
     $form->translator = $this->translator;
     $form->addHidden('datasource');
     $form->addHidden('column');
     $nameInput = $form->addText('name', 'Data field name:')->setAttribute('class', 'normalWidth');
     $nameInput->addRule(Form::MAX_LENGTH, 'Max length of the data field name is %s characters!', 15)->addRule(Form::MIN_LENGTH, 'You have to input data field name!', 1)->addRule(Form::PATTERN, 'Data field name can contain only letters, numbers and underscore and start with a letter!', '[a-zA-Z_][a-zA-Z0-9_]+')->addRule(function (TextInput $control) use($presenter) {
         //kontrola, jestli existuje data field se stejným jménem
         /** @var HiddenField $datasourceInput */
         $datasourceInput = $control->form->getComponent('datasource');
         $datasource = $presenter->datasourcesFacade->findDatasource($datasourceInput->value);
         $datasourceColumns = $datasource->datasourceColumns;
         foreach ($datasourceColumns as $datasourceColumn) {
             if ($datasourceColumn->name == $control->value) {
                 /** @var HiddenField $columnInput */
                 $columnInput = $control->form->getComponent('column');
                 if ($columnInput->value == $datasourceColumn->datasourceColumnId) {
                     return true;
                 } else {
                     return false;
                 }
             }
         }
         return true;
     }, 'Data field with this name already exists!');
     $form->onError[] = function () use($presenter) {
         //při chybě opět zobrazíme přejmenovávací formulář
         $presenter->template->showDatasourceColumnRenameDialog = true;
         if ($presenter->isAjax()) {
             $presenter->redrawControl('datasourceColumnRenameDialog');
         }
     };
     $form->addSubmit('rename', 'Rename data field')->onClick[] = function (SubmitButton $button) use($presenter) {
         //přejmenování data fieldu
         $formValues = $button->form->values;
         $presenter->datasourcesFacade->renameDatasourceColumn($formValues['datasource'], $formValues['column'], $formValues['name']);
         $presenter->redirect('this');
     };
     $stornoButton = $form->addSubmit('storno', 'Storno');
     $stornoButton->validationScope = array();
     $stornoButton->onClick[] = function () use($presenter) {
         if ($presenter->isAjax()) {
             $presenter->redrawControl('datasourceColumnRenameDialog');
         } else {
             $presenter->redirect('this');
         }
     };
     return $form;
 }
开发者ID:kizi,项目名称:easyminer-easyminercenter,代码行数:52,代码来源:OLD_DataPresenter.php

示例5: prepareForm

 /**
  * Upraví formulář pro potřeby RequestButtonu.
  * 	Přidá do action backlink, aby formulář i po odeslání věděl kam se má vrátit.
  * 	Když je vráceno na určitý stav formuláře, nastaví mu data.
  * MUSÍ SE VOLAT PO přidání všech FormControlů do Formu a po připojení na Presenter.
  * MÍSTO VOLÁNÍ TÉTO FUNCKE SE MÚŽE POUŽÍT JAKO FORM RequestButtonReceiver
  *
  * @param AppForm
  * @see RequestButtonReceiver
  *
  */
 public static function prepareForm(AppForm $form)
 {
     if (!$form instanceof RequestButtonReceiver) {
         if ($form->getPresenter(false)) {
             $form->setAction(RequestButtonHelper::prepareAction($form, $form->getAction()));
             $form->setValues(RequestButtonHelper::prepareHttpData($form, $form->getHttpData()));
             foreach ($form->getComponents(TRUE, 'RequestButton') as $rb) {
                 $rb->formIsPrepared = true;
             }
         } else {
             throw new InvalidStateException("Form is not attached to Presenter.");
         }
     }
 }
开发者ID:soundake,项目名称:requestbutton,代码行数:25,代码来源:RequestButtonHelper.php


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