Zend certified PHP/Magento developer

Field number validation

I need to validate a field in a custom form. The field should be not required, and should validate if the content entered in it are numbers. I added the validation on the form which works. What does not work is the validation of this field.

<input type="number" class="product-quantity" name="qty" data-validate="{ required: false, number: true }"/>

I have tried using number and using validate-number but it does not help. After typing for example abc the validation passes.

Thank you in advance for your help!