當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。