Skip to content

Form::isSubmitted() has @return ISubmitterControl|false, but should be @return ISubmitterControl|bool #169

@Grez

Description

@Grez
  • bug report? yes
  • feature request? no
  • version: 2.4.4

Description

If the submit button ceases to exist before processing the form, Form::isSubmitted() will return TRUE, but docs say it can only return ISubmitterControl|false

Steps To Reproduce

    protected function createComponentBlaForm()
    {
        $form = new Nette\Application\UI\Form();

        // easiest way to simulate disappearing button
        if (mt_rand(1, 2) === 1) {
            $form->addSubmit('send');
        } else {
            \Tracy\Debugger::barDump('Sending button does not exist');
        }

        $form->onSuccess[] = function (Nette\Application\UI\Form $form) {
            \Tracy\Debugger::barDump($form->isSubmitted());
        };

        return $form;
    }

Possible results after sending:

screen shot 2017-10-06 at 00 46 06

screen shot 2017-10-06 at 00 45 59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions