How can I setup number form field to have only numbers >=0?

Hi All,

I’m new in Webflow… Is there any way to setup that my form field type number only have values >=0?

image

As you can see I’m able to enter negative values.

Thank you!

By default number fields should not allow negative numbers, check maybe if you’ve enabled Allow Negative Numbers for the field. Check the screenshot.

Also it would be best to share your project so others can properly diagnose your issue.

Appreciate your feedback, however this is not field from CMS collection - it is basic form field and I just selected to be type Number.
Please check screenshot:

image

I would share my project, however, I’m not sure if I’m allowed.
Thank you!

Oh ok, for that one simple solution is to apply HTML form validation.

On the number field you can add HTML attribute called min and set value to 0

By the way, this is just simple HTML validation, someone who know how to inspect and edit HTML can easily change this. So for advance implementation you should apply Javascript validation.

Thank you very much for this!!! It helped me and it works now.

Do you maybe know if there is a way to validate URL field?
image

I tried with startsWith but it is not working:

image

Thank you very much once again.

If you have your input type set as URL then it should already work. But for URL it can only be detected when you hit submit button.

You can read more about input fields and what attributes you can apply on them here