0

I want to change default validation message in system config field.

Below is my system.xml code.

<field id="maxlabel" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="13" translate="label" type="text">
                <label>Max Number of image</label>                    
                <validate>validate-digits validate-not-negative-number validate-greater-than-zero validate-digits-range digits-range-0-5</validate>
                <comment>Min - 1. Max - 5</comment>
            </field>

It is working fine but it is display error message like below.

The value is not within the specified range.

But i want to change this message like below.

Please enter value less than or equal to 5

Is any default validation class available for this type of validation? or is there any way to add custom Rule or Method for validation?


EDIT :

I tried to add custom validation using below refrance but still no luck.

  1. Magento 2: Custom validation for system.xml
  2. Custom field validation in system.xml

Any help would be Appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.