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

DRAFT FEATURE: add 'validationErrorMessage' option #3141

Closed

Conversation

MiauzGenau
Copy link

The 'validationErrorMessage' option for Validators was introduced here: neos/neos-ui#2996.

But is currently unusable, see: neos/neos-ui#3691

In a first DRAFT I added 'validationErrorMessage' as an supported option, for the RegularExpressionValidator.
If this looks good, I would add the option to the other validators (adopted in Neos-UI) as well.
So please give some Feedback : )

resolved: neos/neos-ui#3691

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked wit !!! and have upgrade-instructions

@github-actions github-actions bot added the 9.0 label Aug 25, 2023
@kdambekalns kdambekalns marked this pull request as ready for review August 30, 2023 08:12
@kitsunet
Copy link
Member

Right, this makes sense to me like this, sorry commented on the closed change.

@@ -487,6 +487,7 @@ Arguments
*********

* ``regularExpression`` (string): The regular expression to use for validation, used as given
* ``validationErrorMessage`` (string): The error message to show for validation, if the regular expression validation fails
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is auto generated from the code and should be updted automatically, so no need to manually change it it, that might just lead to errors with the generator. :)

@@ -39,7 +40,11 @@ protected function isValid($value)
{
$result = preg_match($this->options['regularExpression'], $value);
if ($result === 0) {
$this->addError('The given subject did not match the pattern. Got: %1$s', 1221565130, [$value]);
if ($this->options['validationErrorMessage']) {
$this->addError($this->options['validationErrorMessage'], 1692962252);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder (mostly a question to other team members with an opinion about this) do we not want to use the same error code here? After all it's the same error just the message is different.

@mhsdesign
Copy link
Member

As stated here: I would vouch for closing this and fixing it in the ui #3134 (comment)

@mhsdesign mhsdesign marked this pull request as draft January 17, 2024 09:33
@MiauzGenau MiauzGenau closed this Jan 17, 2024
@MiauzGenau MiauzGenau deleted the validation-error-message-customizable branch January 18, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Regexvalidator option throws error on apply
3 participants