0

I am trying to implement the validate-number-range but it is not working.

Please find the implementation below

    <field name="custom_sequence" sortOrder="40" formElement="input">
            <settings>
                <required>true</required>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                    <rule name="validate-number" xsi:type="boolean">true</rule>
                    <rule name="validate-number-range" xsi:type="boolean">true</rule>
                    <rule name="number-range-1-50" xsi:type="boolean">true</rule>
                </validation>
                <dataType>number</dataType>
                <label translate="true">Custom Sequence</label>
                <dataScope>custom_sequence</dataScope>
                <componentType>field</componentType>
            </settings>
        </field>

1 Answer 1

1

The validate-number-range rule must have the type string and should have the range as its value, e. g. <rule name="validate-number-range" xsi:type="string">1-50</rule>.

Example snippet:

<validation>
    <rule name="required-entry" xsi:type="boolean">true</rule>
    <rule name="validate-number" xsi:type="boolean">true</rule>
    <rule name="validate-number-range" xsi:type="string">1.00-50.00</rule>
</validation>
1
  • thanks you Pascal Zarrad, You are my saviour. Aug 22, 2021 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.