nette 2.1 dev – setValidationScope FALSE don't turn off custom validation

Notice: This thread is very old.
duskohu
Member | 778
+
0
-

When I have form, and use setValidationScope(FALSE), then custom validation doesn't turn off. Turn off only input validation. Callback validateForm is executed. Is this correct?

protected function createComponentForm()
{
	$form = new Form;

	$form->addText("email", "Email")
		->addRule($form::FILLED, 'Fill your email address');

	$form->addSubmit('send', 'Send');
		->setValidationScope(FALSE);

	$form->onSuccess[] = callback($this, 'processForm');

	$form->onValidate[] = callback($this, 'validateForm');

	return $form;
}

Last edited by duskohu (2013-07-26 08:34)

MartyIX
Member | 217
+
0
-

I experienced the same problem. I'm not sure if it is a bug or a feature. :)

Jan Tvrdík
Nette guru | 2595
+
0
-

I think this is a feature but it's hard to tell.

duskohu
Member | 778
+
0
-

I do not know, but I use this

public function validateForm(Form $form)
{
	if ($form->submitted->getValidationScope() === NULL) {
		// validate process
	}
}