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

6 years ago

duskohu
Member | 746
+
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)

6 years ago

MartyIX
Member | 219
+
0
-

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

6 years ago

Jan Tvrdík
Nette guru | 2556
+
0
-

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

6 years ago

duskohu
Member | 746
+
0
-

I do not know, but I use this

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