praxedis

New Signer Experience: Two validation errors instead of one

0 votes

Code:

.withValidation(FieldValidatorBuilder.regex("^\\d{2}/\\d{4}$").required().withErrorMessage("Please enter a valid retirement date (MM/YYYY)"))

When we are testing and when we do not enter a value, we are seeing what looks like an overriding validation error message than the one we configure in the code. See attached. When we enter a value that does not adhere to regex, we see correct validation error.

We would like the error we configure in the code to be the one we see whether there is a value entered or not.

Please advise.


Attachments

Reply to: New Signer Experience: Two validation errors instead of one

0 votes

Hi Esteban,

 

I believe we have reported this before, however, it was not fixed in the exact same way as the classic signing ceremony - that the error types and their error messages are still categorized and prioritized in below order:

If required > If less than minimal length (front end prevents signer to insert more than maximum length) > If pattern is respected

So in your case, you will see your customized error message as long as you entered anything to the field. 

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: New Signer Experience: Two validation errors instead of one

0 votes

So, just so I understand correctly: A user will get a "required" error message ahead of the regex error message if there is no value in the field. And there is no way to override the required error message. Is that correct?


Reply to: New Signer Experience: Two validation errors instead of one

0 votes

Can I do this?

.withValidation(FieldValidatorBuilder.basic().required().withErrorMessage("Please enter a valid retirement date (MM/YYYY)"))
.withValidation(FieldValidatorBuilder.regex("^\\d{2}/\\d{4}$").withErrorMessage("Please enter a valid retirement date (MM/YYYY)"))


Reply to: New Signer Experience: Two validation errors instead of one

0 votes

Okay, thank you.


Reply to:

0 votes

I see. Let me put it in another way - if you already have the Regular expression like below, which implies the input can't be empty, should be exactly 2 numbers follows by slash follows by 4 numbers (7 chars), you no longer need to explicitly specify .required() or .minLength()/.maxLength()

.withValidation(FieldValidatorBuilder.regex("^\\d{2}/\\d{4}$").withErrorMessage("Please enter a valid retirement date (MM/YYYY)"))


In which case, only the customized error message will be displayed.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: New Signer Experience: Two validation errors instead of one

0 votes

Ok, so all I need to do is take out the "required()" and it will work as expected?


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off