Skip to content

Number type input validation problem if number type input depends on other input #289

Closed
@forgie1

Description

@forgie1

Version: 3.3.0 and others

Bug Description

If input is of type number and depends on other input and number validation fails, than form is not valid but no error is added to Nette.formErrors. Even no further errors are added.

Steps To Reproduce

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

		$dep = $form->addCheckbox('dep', 'Num required');

		$num = $form->addText('num', 'Number');
		$num->setHtmlAttribute('type', 'number');
		$num->addConditionOn($dep, $form::EQUAL, true)->setRequired();

		$form->addText('required', 'Required')->setRequired();

		$form->addSubmit('submit', 'done');

		return $form;
	}

Check the checkbox.
Enter non numeric value, eg 5X to Number field.
Do not fill Required field.
And submit the form.

No error is displayed.

Expected Behavior

Two errors should be displayed:

  1. Please enter a valid value.
  2. This field is required.

Possible Solution

See related MR.

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