Max number input - still allows numbers over

HI all,

I’m probably missing something, but, despite the min/max number inputs I have set, it still allows figures over 100.

Any idea why?

1 Like

browser validation allows to input invalid values, it just marks the input as not valid so that a submit button in a form container will not trigger.
this keeps users’s expectations: if I press a key while focused in the input I should see that key added.
it’s up to you to add styles to show that the value is invalid and an helpful message indicating the error.
if your input is not in a form container with your logic in the form submit workflow you need to check the input value at the beginning of yoir workflow.
you can read more here

Intuitively, with WeWeb being no code, I believe the min/max should be limiting the input as that’s what I was expecting. Input type is set to number.

In theory, this should also work, but isn’t:

image

I’m unsure without writing some JS, how to limit the user inputting any number.

As @dorilama said, the browser can not validate.
Basically the same if you want to get ip address from a visitor.
You have to build something seversided to return a result for inputs or whatever.

@what.gift
This is the output, JS can not do anything unless the logic is running in the backend and return a result. Like a TV

I didn’t say the browser can’t validate. The browser can indeed validate and mark the input as invalid. It won’t change the value for you or add any other logic based on the validation. it’s up to you to implement that and of course you need to validate the data as well on the backend.

I mean it can validate, my bad. :slight_smile:
Just not safe.

1 Like