Kentico 13 - Validation rules for built-in form fields

Leonardo Hickstein asked on March 26, 2021 17:10

Hi,

I have a contact form with name, email, and message fields, all set as required. If no data is entered in any of these fields I get the message "Please enter a value." for each of them.

I need to customize the message for each of them. Tried to do it through validation rules but it doesn't seem to be working. Tried adding a validation rule for a minimum length of 1 or 2 with a custom message but it is never triggered. Am I doing anything wrong? Any tips?

P.S.: I'm using the built-in form added through the admin portal which means I don't have any HTML/CSS/UI view code for that.

Thanks

Recent Answers


Jeroen Fürst answered on March 29, 2021 08:07 (last edited on March 29, 2021 08:08)

Hi Leonardo,

This could be handled using the resource string: general.requiresvalue. Please note that this will update the value everywhere it is being used. For more info check out the documentation

Cheers, Jeroen

0 votesVote for this answer Mark as a Correct answer

Leonardo Hickstein answered on March 29, 2021 08:13

Hi Jeroen, thanks for your comment.

So does that mean I cannot customize the error message per field and form?

Then why do we have validation rules (it doesn't seem to work) if not for these cases?

Thanks in advance.

0 votesVote for this answer Mark as a Correct answer

Jeroen Fürst answered on March 29, 2021 08:37

Hi Leonardo,

Have you tried the minimum validation rule in combination with removing the required check?

Cheers, Jeroen

0 votesVote for this answer Mark as a Correct answer

Leonardo Hickstein answered on April 6, 2021 07:54

We decided to change the message globally so this issue is fixed now. Thanks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.