Number Field Validation

Hello! I'm in the midst of updating all my components, so you may see a few questions from me...

I used to have the following validation in my number field to ensure that the input is always an integer:

{{ !Number.isInteger(self.value) ? 'Not an integer' : '' }}

This still works, except now it is always firing - it used to only fire when the field value was not null. Now, the form has a validation error for this field before you have typed anything, however, I need to allow for null.

Is there a new, better way to perform this validation?

Thank you!


Only run it on value change perhaps?

1 Like


Hey Dan! Adding on this check for if a value is not null should work.

{{ !Number.isInteger(self.value) && self.value != null ? 'Not an integer' : ''}}

You will also need to make sure to check that the toggle 'Allow null value' is turned on and the toggle for 'required field' is off to allow for the submission of null.

1 Like

Works like a charm - thank you @lauren.gus and @brettski for your help!