Skip to content

Nette\Forms\Form is not Nette\Application\UI\Form but fails silently #147

@MaPePeR

Description

@MaPePeR
  • bug report? no
  • feature request? yes
  • version: 2.4

Description

I'm just starting to learn Nette and after looking through documentation and example code i tried to setup a very simple Form. The Form rendered fine, but the onSuccess handler was never executed and it took me a very long time to figure out the problem:
I created a Nette\Forms\Form-Object instead of the Nette\Application\UI\Form-Object that i was supposed to use.
It would be great if there would be an Exception if one tries to use the Nette\Forms\Form like a Nette\Application\UI\Form. Or at least mention this pitfall in the documentation somewhere.

Thanks.

Steps To Reproduce

  1. Be very inexperienced with the Nette Framework
  2. Write code like this in your Presenter:
	public function createComponentMyForm() {
		$form = new Nette\Forms\Form;//<- This is the Problem. 
		$form->addSubmit('submit_it', "Submit!");
		$form->onSuccess[] = [$this, 'formSucceeded'];
		return $form;
	}
	
	public function formSucceeded($form, $values) {
		//This will never be called
	}
  1. Get frustated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions