TODO for How to set custom validation message
Sample code from .phtml form
How to set custom validation message :
Today we look into one of the smallest part part but very much needed when we have to make user friendly.
We can get this done with a simple data attribute named “data-msg-
<input type="text" name="telephone" id="telephone" value="<?= @$block->escapeHtmlAttr($block->getTelephone()) ?>" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" class="input-text validate-digits validate-digits-range digits-range-10000000000-99999999999 <?= $_validationClass ?: '' ?>" data-msg-validate-digits-range="The value is not within the specified range. Entry should be of 11 digits" />
Now its look simple but still need to pay little attention over the class name.
Take a few examples from me like for “required" we will use something like data-msg-required-entry="Custom message" ok let have one more example for “validate-digits" we can add it like this data-msg-validate-digits="Digit only"
There is no limitation in using data-msg. you can use multiple in same input as per validation class.
Please comment below whatever every comes in your mind weather it is question, anger, suggestion, improvement. Please write down below. I want to hear you and if you want me to make a post on something or wanting snippet please that also you can mention in comment.
I will surely answer your comment not letting go unanswered or help you in your query.
You all are the semicolon to my statements; Please support me; Thanks