0

How to add digits range validation rule to the input field inside the UI-form?

3

In case you needed a digits range validation you should pass a range inside the rule's body as a --separated string, like this:

<field name="day" formElement="input">
    <settings>
        <dataType>text</dataType>
        <label translate="true">Day</label>
        <validation>
            <rule name="validate-number" xsi:type="boolean">true</rule>
            <rule name="validate-digits-range" xsi:type="string">1-31</rule>
        </validation>
    </settings>
</field>

which leads to the error The value is not within the specified range. when value less or greater than specified in the rule's body.

Your Answer

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

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