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

BUGFIX: add 'validationErrorMessage' as a supported option #3133

Conversation

MiauzGenau
Copy link

Add 'validationErrorMessage' as an supported option, for the RegularExpressionValidator.

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

@crydotsnake
Copy link
Member

Thanks for the fix.

Is this bug related too Neos 9? otherwise the PR should target the Neos 7.3 branch.

@MiauzGenau
Copy link
Author

Create new PR on 7.3 branch here: #3134

@MiauzGenau MiauzGenau closed this Aug 11, 2023
@fcool
Copy link
Contributor

fcool commented Aug 15, 2023

If the aim is to change the error message, there are plenty of possibilities. You could use the code and provide an own translation. Or you could override the translation flow provides. Why would you have the message changeable for each validator instance?
And given the use case is convincing: Why only with the regex validator? And not with all validators?

@@ -24,7 +24,8 @@ class RegularExpressionValidator extends AbstractValidator
* @var array
*/
protected $supportedOptions = [
'regularExpression' => ['', 'The regular expression to use for validation, used as given', 'string', true]
'regularExpression' => ['', 'The regular expression to use for validation, used as given', 'string', true],
'validationErrorMessage' => ['', 'The error message to show for validation, if the regular expression validation fails', 'string', false]
Copy link
Member

Choose a reason for hiding this comment

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

This is only enough to fullfill the needs of the Neos validation system so we do not get an exception here, but in fact this new supported option should impact eg.
https://github.com/neos/flow-development-collection/pull/3133/files#diff-2ecda0a3f7d78fb28fd5cffe20976014c4281e728f4193e505844d380144e9f1R43

otherwise it makes absolutely no sense from the PHP side of things, as nothing happens when I set this option.

@MiauzGenau MiauzGenau deleted the regexvalidator-error-message-option-support branch January 18, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Regexvalidator option throws error on apply
4 participants