#100678ext:form : errorMessage for RegularExpression validator is ignored when set in Yaml
Description
Hi,
since #91719 it is possible to define a custom validation error message for RegularExpression validators.
When set in Yaml as following, this error message is ignored.
options:
errorMessage: "my custom error message"
It seems that the TranslationService uses this custom errorMessage as the very last fallback only if no translation for the corresponding error code is found in language files.
The translation for the corresponding error code takes precedence.
<trans-unit id="validation.error.1221565130" xml:space="preserve">
<source>Ce champ contient des caractères non autorisés</source>
</trans-unit>
I expected that the custom error message would have precedence.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 5
-
Garvin Hicking commented and changed status
NewClosed <span data-processor="relativetime" data-value="2025-09-22T13:59:01+00:00" > 09/22/25, 13:59 </span>This should be resolved; no more activity in this issue, thus closing it now. If there’s still an issue please feel free to update here.
-
Sébastien Delcroix commented <span data-processor="relativetime" data-value="2025-09-22T16:16:14+00:00" > 09/22/25, 16:16 </span>
Sorry I had issue with my DDEV v13 instance lately (after a macOS upgrade).
I’ve just tried with the following YAML form definition on the latest v13 and the errorMessage from YAML (“Error Message overridden”) is not displayed. The displayed error message is the default one (“You must enter a valid value. Please refer to the description of this field.”) :
type: Form identifier: 'ContactFormV13' label: '[Commun] Formulaire de contact' prototypeName: standard renderingOptions: controllerAction: perform addQueryString: false argumentsToBeExcludedFromQueryString: [] additionalParams: [] submitButtonLabel: 'Envoyer votre message' renderables: page2: identifier: p2 type: Page label: "Saisie de votre demande" renderables: - type: Fieldset identifier: p2f1 label: "Identification du demandeur" renderables: - type: GridRow identifier: p2f1c1r1 renderables: - identifier: name label: "Prénom et Nom" type: Text properties: fluidAdditionalAttributes: maxlength: 50 gridColumnClassAutoConfiguration: viewPorts: xs: numbersOfColumnsToUse: 12 validators: - identifier: NotEmpty - identifier: StringLength options: maximum: 50 - identifier: RegularExpression options: regularExpression: /^[A-Za-zÀ-ÖØ-öø-ÿœŒ\-\'\’\s]*$/ errorMessage: "Error Message overridden" -
Sébastien Delcroix changed TYPO3 Version
1113 PHP Version7.48.2 <span data-processor="relativetime" data-value="2025-09-22T16:17:36+00:00" > 09/22/25, 16:17 </span> -
Josua Vogel commented <span data-processor="relativetime" data-value="2025-09-25T18:59:32+00:00" > 09/25/25, 18:59 </span>
The form definition is invalid. A correct structure to overwrite the error message would be the following:
- defaultValue: '' type: Text identifier: text-1 label: Text properties: validationErrorMessages: - code: 1221565130 message: "Error Message overridden" validators: - options: regularExpression: /^[A-Za-zÀ-ÖØ-öø-ÿœŒ\-\'\’\s]*$/ identifier: RegularExpression
Hi @rvvn ,
I checked it in TYPO3 13 and the custom error message is now preferred. Can you confirm that?