0

magento 2 have Validation clases for admin forms Like this for integer. What is for floatting numbers like 12.00 or 23.33

        <item name="validate-integer" xsi:type="boolean">true</item>

Thanks for your valuable help

1 Answer 1

0

You can use pattern for validate numbers:

data-validate="{'required':true, 'pattern':/^\d+(\.\d{1,2})?$/, 'validate-greater-than-zero':true}"

You can validate form by below method:

<script>
    require(['jquery'], function($) {
        $(function() {
            $('#your-form-id').submit(function() {
                if($('#your-form-id').valid()) {
                    //your further code
                }
                return false;
            });
        });
    });
</script>
0

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.