Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
forgie1 opened this issue Jun 20, 2022 · 0 comments

Comments

@forgie1
Copy link

forgie1 commented Jun 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants