/**
  * Document form factory.
  *
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentDocumentTemplateForm()
 {
     $form = BaseFormRenderer::factory();
     $form->addText('name', 'Name:');
     $form->addTextArea('content', 'Content:');
     if ($this->documentTemplate) {
         $form->addHidden('id');
         $form->setDefaults($this->documentTemplate);
     }
     $form->addSubmit('send', $this->documentTemplate ? 'Save template' : 'Add template');
     $form->onSuccess[] = $this->documentTemplateFormSucceeded;
     return $form;
 }
 /**
  * User Form factory.
  *
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentUserForm()
 {
     $form = BaseFormRenderer::factory();
     $form->addText('name', 'Name:');
     if ($this->mainManager->isImage()) {
         $form->addUpload('avatar', 'Photo:')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Please select image file');
     }
     $form->addSubmit('send', 'Update profile');
     $form->onSuccess[] = $this->userFormSucceeded;
     if ($this->detailObject) {
         $form->setDefaults($this->detailObject);
     }
     return $form;
 }
 public function createComponentExampleRendererForm()
 {
     $form = BaseFormRenderer::factory();
     $form->addText('name', "Name:");
     $form->addPassword('password', "Password:"******"Textarea");
     $form->addSelect('select', "Select", ['Option 1', 'Option 2']);
     $form->addUpload('upload', 'Upload');
     $form->addCheckbox('checkbox', 'Checkbox');
     $form->addRadioList('radioList', 'Radio list', ['Item A', 'Item B']);
     $form->addCheckboxList('checkboxList', 'Checkbox list,', ['Item A', 'Item B']);
     $form->addText('date', 'Date:')->getControlPrototype()->class('b-date-input');
     $form->addText('datetime', 'Date time:')->getControlPrototype()->class('b-date-input b-date-input--datetime');
     $form->addSubmit('actionSend', 'Save');
     $form->onSuccess[] = array($this, 'exampleRendererFormSubmitted');
     return $form;
 }
Example #4
0
 public function createComponentObjectForm()
 {
     $form = BaseFormRenderer::factory();
     if (!$this->detailObject) {
         $form->addText('slug', 'slug');
     }
     $form->addText('title', 'Title:');
     $input = $form->addTextarea('content', "Content:")->getControlPrototype();
     $input->data('codemirror', 'init');
     $input->data('mode', 'texy');
     if ($this->detailObject) {
         $form->addHidden('id');
         $form->setDefaults($this->detailObject->toArray());
     }
     $form->addSubmit('actionSend', $this->detailObject ? 'Save' : 'Add');
     $form->onSuccess[] = $this->objectFormSucceeded;
     return $form;
 }
 /**
  * Change Email step two Form factory.
  *
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentChangeEmailStepTwoForm()
 {
     $form = BaseFormRenderer::factory();
     $form->addText('code_one', 'Code one:')->setRequired('Please enter first code.');
     $form->addText('code_two', 'Code two:')->setRequired('Please enter second code.');
     $form->addSubmit('send', 'Change');
     $form->onSuccess[] = $this->changeEmailStepTwoFormSucceeded;
     return $form;
 }
Example #6
0
 protected function createComponentQuickSearchForm()
 {
     $form = BaseFormRenderer::factory();
     $form->setMethod('GET');
     $form->addText('q', 'Query:');
     $form->addSubmit('search', 'Search');
     $form->onSuccess[] = $this->quickSearchFormSucceeded;
     return $form;
 }