FormSucceed function not called

about a month ago

+
-1
-

I have a user registration form.
I can render the form easily using

{control registerForm}

However, I wish to render individual elements within my own CSS layout.
I have been reading the docs at https://doc.nette.org/en/3.0/forms and thought I had a handle on it..

The form name is registerForm, and is created from

protected function createComponentRegisterForm()

The form elements are rendered using:

{form registerForm}
{label first_names /}
{input first_names }

{/form}

And all works well.
When submitted, the createComponentRegisterForm() is called, however, the Succeed method is never called, as when using:

{control registerForm}

So, the form is an instance of Nette\Forms\Form as per the docs instructions, unlike other forms which use NetNette\Application\UI\Form

So, why is the method registerFormSucceeded() never called, and I need to process the form data in the createComponentRegisterForm() method?

if( $form->isSuccess() )
{
   /// process the form
}

about a month ago

Felix
Nette Core | 1034
+
+1
-

Hi Kevin. Form must be instance of Nette\Application\UI\Form.

Use Nette\Forms\Form only when do you need to use nette/forms without the rest of the nette framework (nette/application, etc).


Example of standalone nette/forms.

$form = new Nette\Forms\Form;
$form->setAction('/submit.php');
$form->setMethod('GET');

if ($form->isSuccess()) {
	echo 'Form was filled and submitted successfully';

	$values = $form->getValues();
	dump($values);
}