Skip to content

Missing validator message should contain validator name.#263

Merged
dg merged 2 commits into
nette:masterfrom
janbarasek:patch-2
Jan 6, 2021
Merged

Missing validator message should contain validator name.#263
dg merged 2 commits into
nette:masterfrom
janbarasek:patch-2

Conversation

@janbarasek

@janbarasek janbarasek commented Jan 6, 2021

Copy link
Copy Markdown
Contributor
  • new feature
  • BC break? no

In case of:

$form->addText('stars', 'Stars')
	->setRequired('Please select stars.')
	->addRule(Form::NUMERIC)
	->addRule(Form::MIN, null, 0)
	->addRule(Form::MAX, null, 5);

It is not clear from the original message in which validation rule the validation message is missing. The form can be built dynamically from multiple places. This feature adds the name of the validation rule that requires the message.

Thank you.

@dg

dg commented Jan 6, 2021

Copy link
Copy Markdown
Member

$rule->validator can be also callable array or Closure.

@janbarasek

Copy link
Copy Markdown
Contributor Author

@dg FIxed, validator will be inserted only in case of string.

@dg

dg commented Jan 6, 2021

Copy link
Copy Markdown
Member

Thanks

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 this pull request may close these issues.

2 participants