コード例 #1
0
 public function submitRegisterForm(AppForm $form)
 {
     $data = $form->getValues();
     AuthService::register($data['login'], $data['password']);
     $this->flashMessage('Successfully registered');
     $this->redirect('default');
 }
コード例 #2
0
ファイル: HomepagePresenter.php プロジェクト: GymvodNette/cv1
 protected function createComponentMyForm()
 {
     $form = new AppForm();
     $form->addText('name', 'Name');
     $form->addSubmit('submit');
     $form->onSubmit[] = callback($this, 'submitMyForm');
     return $form;
 }
コード例 #3
0
ファイル: HomepagePresenter.php プロジェクト: jff15/travelbot
 /**
  * locationsForm submit handler (trip saving).
  * @param Nette\Application\AppForm
  */
 public function submitLocationsForm(AppForm $form)
 {
     $values = $form->values;
     $service = new TripService($this->entityManager);
     try {
         $trip = $service->buildTrip($values['from'], $values['to'], new TripCurlMapper());
         $service->save($trip);
         $this->flashMessage('Trip successfully saved.');
         $this->redirect('Trip:show', array('id' => $trip->id));
     } catch (InvalidStateException $e) {
         $form->addError('Error occurred while getting directions. Please try again later.');
     }
 }
コード例 #4
0
ファイル: BaseForm.php プロジェクト: janmarek/Neuron
 public function render()
 {
     // render("begin") or render("end")
     $args = func_get_args();
     if ($args) {
         parent::render($args[0]);
         return;
     }
     $this->getTemplate()->form = $this;
     $this->getTemplate()->render();
 }
コード例 #5
0
ファイル: TagPresenter.php プロジェクト: janmarek/Ormion
 protected function createComponentAddTagForm()
 {
     $form = new AppForm();
     $form->addText("name", "Name", 40, 50);
     $form->addSubmit("s", "Add");
     $presenter = $this;
     $form->onSubmit[] = function ($form) use($presenter) {
         $name = $form->values["name"];
         $tag = new Tag();
         $tag->name = $name;
         $tag->url = String::webalize($name);
         try {
             $tag->save();
             $presenter->flashMessage("Tag was added!");
             $presenter->redirect("default");
         } catch (\ModelException $e) {
             $tag->addErrorsToForm($form);
         }
     };
     return $form;
 }
コード例 #6
0
ファイル: AuthPresenter.php プロジェクト: jakubkulhan/nette
 /**
  * Login form component factory.
  * @return mixed
  */
 protected function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('username', 'Username:'******'Please provide a username.');
     $form->addPassword('password', 'Password:'******'Please provide a password.');
     $form->addSubmit('login', 'Login');
     $form->addProtection('Please submit this form again (security token has expired).');
     $form->onSubmit[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
コード例 #7
0
ファイル: LoginPresenter.php プロジェクト: jakubkulhan/nette
 /**
  * Login form component factory.
  * @return mixed
  */
 protected function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('username', 'Username:'******'Please provide a username.');
     $form->addPassword('password', 'Password:'******'Please provide a password.');
     $form->addCheckbox('remember', 'Remember me on this computer');
     $form->addSubmit('login', 'Login');
     $form->onSubmit[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
コード例 #8
0
ファイル: EditableGrid.php プロジェクト: v6ak/Gridito
 private function createBaseForm($name)
 {
     $f = new AppForm($this, $name);
     $f->addProtection();
     return $f;
 }
コード例 #9
0
 /**
  * Album delete form component factory.
  * @return mixed
  */
 protected function createComponentDeleteForm()
 {
     $form = new AppForm();
     $form->addSubmit('cancel', 'Cancel');
     $form->addSubmit('delete', 'Delete')->setAttribute('class', 'default');
     $form->onSubmit[] = callback($this, 'deleteFormSubmitted');
     $form->addProtection('Please submit this form again (security token has expired).');
     return $form;
 }
コード例 #10
0
ファイル: ConfirmationDialog.php プロジェクト: bazo/Mokuji
 /**
  * Return element prototype of nested Form
  * @return \Nette\Web\Html
  */
 public function getFormElementPrototype()
 {
     return $this->form->getElementPrototype();
 }
コード例 #11
0
ファイル: PagePresenter.php プロジェクト: janmarek/Ormion
 protected function createComponentAddCommentForm()
 {
     $form = new AppForm();
     $form->addTextArea("text", "Text", 40, 10);
     $form->addText("name", "Author", 40);
     $form->addText("mail", "E-mail", 40);
     $form->addSubmit("s", "Send comment");
     $presenter = $this;
     $form->onSubmit[] = function ($form) use($presenter) {
         try {
             $values = $form->values;
             $values["page"] = $presenter->getParam("id");
             $comment = Comment::create($values);
             $comment->save();
             $presenter->flashMessage("Comment added!");
             $presenter->redirect("this");
         } catch (ModelException $e) {
             $comment->addErrorsToForm($form);
         }
     };
     return $form;
 }
コード例 #12
0
ファイル: ContactForm.php プロジェクト: newPOPE/screencast
	public function __construct(Nette\IComponentContainer $parent = NULL, $name = NULL) {
		parent::__construct($parent, $name);
		
		$this->buildForm();
	}