本文整理匯總了PHP中Nette\Application\UI\Form::addSubmit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::addSubmit方法的具體用法?PHP Form::addSubmit怎麽用?PHP Form::addSubmit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addSubmit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createComponentCourseRegistration
protected function createComponentCourseRegistration()
{
$msgNameReq = "Zadejte prosím jméno a příjmení.";
$msgEmailReq = "Zadejte prosím emailovou adresu.";
$msgPhoneReq = "Zadejte prosím telefonní číslo.";
$msgPhoneBad = "Telefon není správně vyplněn.";
$msgDateReq = "Vyberte prosím termín akce.";
$persons = array('1 osoba', '2 osoby', '3 osoby', '4 osoby', '5 osob');
$dates = array();
foreach ($this->context->parameters['courses'][$this->course]['dates'] as $date) {
$dates[] = $this->template->date($date['date'], '%d.%m.%Y');
}
$form = new Form();
$form->addText('name', 'Jméno', NULL, 60)->setAttribute('placeholder', 'Jméno a příjmení')->setAttribute('tabindex', 1)->addRule(~$form::EQUAL, $msgNameReq, $form['name']->control->attrs['placeholder'])->setRequired($msgNameReq);
$form->addText('email', 'Email', NULL, 40)->setAttribute('placeholder', 'Email')->setAttribute('tabindex', 2)->addRule(~$form::EQUAL, $msgEmailReq, $form['email']->control->attrs['placeholder'])->setRequired($msgEmailReq)->addRule(Form::EMAIL, '%label není správně vyplněn.');
$form->addText('phone', 'Telefon', NULL, 9)->setAttribute('placeholder', 'Telefon')->setAttribute('tabindex', 3)->addRule(~$form::EQUAL, $msgPhoneReq, $form['phone']->control->attrs['placeholder'])->setRequired($msgPhoneReq)->addRule(Form::INTEGER, $msgPhoneBad)->addRule(Form::LENGTH, $msgPhoneBad, 9);
$form->addSelect('date', 'Termín konání')->setPrompt('Zvolte termín konání')->setItems($dates)->setRequired($msgDateReq);
if (count($dates) == 1) {
$form['date']->setDefaultValue(0);
}
$form->addSelect('person', 'Počet')->setItems($persons, FALSE);
$form->addTextArea('note', 'Poznámka', NULL)->setAttribute('placeholder', 'Jakýkoli dotaz nebo zpráva.')->setAttribute('tabindex', 4)->addRule(Form::MAX_LENGTH, 'Poznámka může obsahovat maximálně 1000 znaků.', 1000);
$form->addSubmit('send', 'Odeslat')->setAttribute('tabindex', 5)->setAttribute('class', 'button');
$form->addSubmit('storno', 'Storno')->setAttribute('tabindex', 6)->setValidationScope(NULL)->setAttribute('class', 'button');
$form->addHidden('spamtest')->addRule($form::EQUAL, 'Robot', array(NULL));
$form->onSuccess[] = callback($this, 'submitRegistration');
return $form;
}
示例2: createComponentForm
protected function createComponentForm()
{
$form = new Nette\Application\UI\Form();
$addEventHandler = callback($this, 'handleAddItem');
$removeEventHandler = callback($this, 'handleRemoveItem');
$form->addGroup('Footer menu');
$form->addDynamic('sections', function (Container $column) use($removeEventHandler, $addEventHandler) {
$column->addText('title', 'Column Title')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Column Title']);
$column->addDynamic('menuItems', function (Container $menuItems) use($removeEventHandler) {
$menuItems->addText('text', 'Text')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Text']);
$menuItems->addText('url', 'Url')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Url']);
$menuItems->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-danger btn-sm')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
$this->controlsInit($menuItems);
}, 1, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-success btn-sm')->addCreateOnClick(true, $addEventHandler);
$column->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-sm btn-danger')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
$this->controlsInit($column);
}, 2, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-sm btn-success')->addCreateOnClick(true, $addEventHandler);
$form->addGroup();
$form->addSubmit('submit', 'Save');
$form->addSubmit('cancel', 'Cancel');
$this->controlsInit($form);
$form->getElementPrototype()->addClass('form-horizontal');
$form->onSuccess[] = $this->processForm;
$form->setRenderer(new Bs3FormRenderer());
return $form;
}
示例3: create
/**
* @return Form
*/
public function create($kat = null, $page = null, $id_user = null)
{
// nastaveni paginatoru
$paginator = new Nette\Utils\Paginator();
$paginator->setItemsPerPage(6);
// def počtu položek na stránce
$paginator->setPage($page);
// def stranky
// selekce upozorneni
$alerts = $this->database->findAll('alert')->where('id_user', $id_user);
if ($kat == 'read') {
// prectene
$alerts = $alerts->where('visited', 1);
} else {
// neprectene
$alerts = $alerts->where('visited', 0);
}
$alerts = $alerts->order('added DESC')->order('id DESC');
// prideleni produktu na stranku
$paginator->setItemCount($alerts->count('*'));
$this->alerts = $alerts->limit($paginator->getLength(), $paginator->getOffset());
$this->kat = $kat;
// form
$form = new Form();
$form->getElementPrototype()->class('ajax form');
foreach ($this->alerts as $alert) {
$form->addCheckbox($alert->id);
}
$form->addSubmit('btndel', 'Smazat upozornění')->setAttribute('class', 'btn btn-primary');
$form->addSubmit('btnvis', 'Označit jako přečtené')->setAttribute('class', 'btn btn-default');
$form->onSuccess[] = array($this, 'formSucceeded');
$form->onError[] = array($this, 'formNotSucceeded');
return $form;
}
示例4: createComponentPolozkaForm
protected function createComponentPolozkaForm($name)
{
$form = new Form();
$form->addText('nazov', 'Nazov');
$form->addSubmit('uloz', 'Uloz')->onClick[] = callback($this, 'nazovFormSubmitted');
$form->addSubmit('cancel', 'Storno')->onClick[] = callback($this, 'cancelFormSubmitted');
return $form;
}
示例5: createComponentDeleteForm
protected function createComponentDeleteForm()
{
$form = new Form();
$form->addSubmit('cancel', 'Cancel')->onClick[] = $this->formCancelled;
$form->addSubmit('delete', 'Delete')->setAttribute('class', 'default')->onClick[] = $this->deleteFormSucceeded;
$form->addProtection();
return $form;
}
示例6: createComponentLocalitiesTableForm
/**
* @Actions itemAutocomplete
*/
protected function createComponentLocalitiesTableForm()
{
$form = new Form();
$form->addText('search', 'Filtr:', 10)->setHtmlId('search');
$form->addSubmit('hide', 'Odebrat označené')->setAttribute('class', 'ajax')->onClick[] = [$this, 'processHide'];
$form->addSubmit('filter', 'Vyhledej')->setAttribute('class', 'ajax')->onClick[] = [$this, 'processFilter'];
$form->addProtection();
return $form;
}
示例7: createComponentDeleteListingForm
protected function createComponentDeleteListingForm()
{
$form = new Form();
$form->addText('check', 'Pro smazání výčetky napište do pole "smazat".')->addRule(Form::FILLED, 'Kontrola musí být vyplněna.')->addRule(Form::EQUAL, 'Pro smazání výčetky musí být vyplňeno správné kontrolní slovo.', 'smazat')->setHtmlId('listing-check-input');
$form->addSubmit('delete', 'Odstranit výčetku')->setHtmlId('listing-remove-button')->onClick[] = [$this, 'processDeleteListing'];
$form->addSubmit('cancel', 'Vrátit se zpět')->setValidationScope(false)->onClick[] = [$this, 'processCancel'];
$form->addProtection();
return $form;
}
示例8: createComponentRaceDeleteConfirm
public function createComponentRaceDeleteConfirm()
{
$form = new Form();
$form->addSubmit('cancel', 'Zpět')->onClick[] = [$this, 'formCancelled'];
$form->addSubmit('send', 'OK');
$form->onSuccess[] = [$this, 'raceDeleteSucceeded'];
$form->setRenderer(new Bs3FormRenderer());
return $form;
}
示例9: createComponentFilter
protected function createComponentFilter()
{
$form = new Form();
$form->setTranslator($this->translator->domain('tags.filter.form'));
$form->getElementPrototype()->class = 'ajax';
$form->addText('name', 'name.label')->setDefaultValue($this->name);
$form->addSubmit('filter', 'filter.label')->onClick[] = [$this, 'filterTags'];
$form->addSubmit('reset', 'reset.label')->onClick[] = [$this, 'filterReset'];
return $form;
}
示例10: createComponentResultPdf
protected function createComponentResultPdf()
{
$form = new Form();
$form->addComponent(new UserPdfSettingsContainer($this->companyParameters), 'userSettings');
$form->addComponent(new ListingsPdfSettingsContainer(), 'listingsSettings');
$form->addSubmit('generatePdf', 'Stáhnout PDF')->onClick[] = [$this, 'generatePdf'];
$form->addSubmit('reset', 'Reset nastavení')->onClick[] = [$this, 'processReset'];
$form->addProtection();
return $form;
}
示例11: createComponentEnterCode
protected function createComponentEnterCode()
{
$form = new Form();
$form->addText('mail', 'Mail:')->setDisabled(true)->setValue($this->user->getIdentity()->mail);
$form->addText('checkCode', 'Kontrolní kód z mailu');
$form->addSubmit('check', 'Zkontrolovat potvrzovací kód');
$form->addSubmit('cancl', 'Začít znova');
$form->onSuccess[] = [$this, 'enterCodeSucceeded'];
return $form;
}
示例12: createComponentDeleteForm
/**
* Album delete form component factory.
* @return mixed
*/
protected function createComponentDeleteForm()
{
$form = new Form();
$form->addHidden('id', $this->getParameter('id'));
$form->addSubmit('cancel', 'Cancel');
$form->addSubmit('delete', 'Delete')->setAttribute('class', 'default');
$form->onSuccess[] = $this->deleteFormSubmitted;
$form->addProtection('Please submit this form again (security token has expired).');
return $form;
}
示例13: createComponentImportTimeForm
/**
* Vytvoří formulář pro zadání parametru pro import vysledku
* @return Form
*/
protected function createComponentImportTimeForm()
{
$form = new UI\Form();
$events_id = $this->database->query('SELECT id FROM sm_event')->fetchPairs();
$form->addSelect('event_id', 'ID závodu')->setPrompt('- Vyberte -')->setItems($events_id, FALSE);
$form->addUpload('file', 'Soubor:')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 1000 kB (1MB).', 1000 * 1024);
$form->addSubmit('check', 'Zkontrolovat');
$form->addSubmit('import', 'Importovat');
$form->onSuccess[] = array($this, 'importTimeFormSucceeded');
return $form;
}
示例14: createComponentForm
protected function createComponentForm()
{
$form = new Form();
$form->setTranslator($this->translator->domain('images.filterForm'));
$form->addText('name', 'name.label', 30);
$form->addSelect('extension', $this->translator->translate('images.filterForm.extension.label'), ['png' => 'PNG', 'jpg' => 'JPG'])->setPrompt($this->translator->translate('images.filterForm.extension.prompt'))->setTranslator(null);
$form->addText('maxWidth', 'maxWidth.label')->addCondition(Form::FILLED)->addRule(Form::INTEGER, 'maxWidth.messages.integerType')->addRule(Form::MIN, 'maxWidth.messages.minValue', 1);
$form->addText('maxHeight', 'maxHeight.label')->addCondition(Form::FILLED)->addRule(Form::INTEGER, 'maxHeight.messages.integerType')->addRule(Form::MIN, 'maxHeight.messages.integerType', 1);
$form->addSubmit('filter', 'filter.caption')->onClick[] = [$this, 'processFilter'];
$form->addSubmit('reset', 'reset.caption')->onClick[] = [$this, 'resetFilter'];
return $form;
}
示例15: createComponentPolozkaForm
protected function createComponentPolozkaForm($name)
{
$hornina = $this->horninaRepository->findAll()->fetchPairs('id', 'nazov');
$form = new Form();
$form->addText('nazov', 'Nazov')->setRequired('Zvolte nazov');
$form->addText('popis', 'Popis')->setRequired('Zvolte popis');
$form->addSelect('idHornina', 'Hornina', $hornina);
$form->addUpload('nazovSuboru', 'Súbor');
$form->addSubmit('uloz', 'Uloz')->onClick[] = callback($this, 'nazovFormSubmitted');
$form->addSubmit('cancel', 'Storno')->onClick[] = callback($this, 'cancelFormSubmitted');
return $form;
}