/** * Factory method for subcomponent form instance. * This factory is called internally by Nette in the component model. * * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addText('email', 'Email')->setRequired('%label is required')->addRule($form::EMAIL, 'Invalid email'); $form->addSubmit('save', 'Get new password'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * Factory method for subcomponent form instance. * This factory is called internally by Nette in the component model. * * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addText('name', 'Name')->setRequired('%label is required'); $form->addSubmit('save', 'Save'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addProtection(); $form->addSubmit('confirm', 'Confirm'); $form->onSuccess[] = function (Form $form) { $this->onConfirm($this); }; return $form; }
/** * Factory method for subcomponent form instance. * This factory is called internally by Nette in the component model. * * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addPassword('current', 'Current password')->setRequired('%label is required'); $form->addPassword('password', 'New password')->setRequired('%label is required'); $form->addPassword('confirm', 'Confirm')->setRequired('%label is required')->addRule(Form::EQUAL, 'New passwords must match', $form['password']); $form->addSubmit('save', 'Change password'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * Factory method for subcomponent form instance. * This factory is called internally by Nette in the component model. * * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addText('name', 'Name')->setRequired('%label is required'); $form->addTextArea('text', 'Text')->setRequired('%label is required'); $form->addSelect('pad', 'Pad')->setPrompt('----------')->setItems($this->padRepository->findPairs('name')); $form->addSubmit('save', 'Save'); $form->onSuccess[] = [$this, 'formSucceeded']; return $form; }
/** * Factory method for subcomponent form instance. * This factory is called internally by Nette in the component model. * * @return Form */ protected function createComponentForm() { $form = $this->formFactory->create(); $form->addText('email', 'Email')->setRequired('%label is required')->addRule($form::EMAIL); $form->addPassword('password', 'Password')->setRequired('%label is required'); $form->addPassword('confirm', 'Confirm')->setRequired('%label is required')->addRule(Form::EQUAL, 'New passwords must match', $form['password']); $form->addSubmit('send'); $form->onSuccess[] = [$this, 'formSucceeded']; $form->onValidate[] = function (Form $form, $values) { if ($this->userRepository->countBy(['email' => $values->email]) > 0) { $form->addError('Account with this email already exists'); } }; return $form; }