k12 MVC approach form required field validation

innovix solutions asked on July 9, 2019 11:40

How can we change required field validated message “please enter a value “ to something “This is a required field”.

Is there a way to customize error message.?

Recent Answers


Brenden Kehren answered on July 9, 2019 14:06

Depending on where you are in Kentico this could change. If you're on a Form, Page Type, Custom Table, or Module Class you can use the form controls validation settings on the field.

For instance if you have a text field for a first name on a page types, you select the textbox form control for the field, then scroll down a little to the validation section and enter in your custom validation message or even enter in your custom validation rule.

0 votesVote for this answer Mark as a Correct answer

Ketan Hirapara answered on July 22, 2019 13:40

For DancingGoat Application example is as below.

You can go to the page type you had created (In my case it's Article page type). Then select the field you want to validate (I has selected "ArticleTitle"). And scroll down to the validation or click on validation link bellow the all fields. Then on the "Default error message" type your message before doing this this field is marked as the Required field by just clicking on the required checkbox. You can also add the validation rule over there by "Validation rules" fields "Add validation rule" button. There you go and you can display the validation message as per your requirement.

1 votesVote for this answer Mark as a Correct answer

jack plouse answered on October 10, 2019 18:26

Note that the validation rules are not applied to an empty field. This seems counter intuitive to me. If my validation rule on a textbox is "min length of 2", the rule is NOT applied unless a value is entered in the box. Please fix Kentico 12 MVC to render the validation error message for empty fields as well. This would allow the error message to be consistent for empty and non-empty validation cases.

0 votesVote for this answer Mark as a Correct answer

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