Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

Prefilled error message for custom validator

$
0
0

We have a custom validator called BankgiroValidator and with that a language file in wwwroot/Resources/LanguageFiles/ that looks like this:

<language><episerver><forms><validators><[namepsace].BankgiroValidator><displayname>Bankgiro</displayname><message>Enter a correct bankgiro</message></[namepsace].BankgiroValidator></validators></forms></episerver</language

The validator inherits ElementValidatorBase and does not override BuildValidationModel(IElementValidatable targetElement).

Now the error message "Enter a correct bankgiro" shows up correctly when using the form on the website. Also if we use a custom error message for that particular field when choosing the validator, that works too. But we'd like to prefill the field for the custom error message with our fallback error message as well, just like it does for the RequiredValidator (which is the one called "Obligatorisk" in the screenshot):

Any ideas on how to achieve this?


Viewing all articles
Browse latest Browse all 8020

Trending Articles