Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Input 'number' with min and max not checking manual input #173

Closed
radekwlsk opened this issue Mar 12, 2018 · 3 comments
Closed

Input 'number' with min and max not checking manual input #173

radekwlsk opened this issue Mar 12, 2018 · 3 comments

Comments

@radekwlsk
Copy link

The dcc.Input component set to type='number' with min and max defined checks the value only when using the input's arrows. On manual input any value can be entered, only regexp for number is checked.

I think it should apply min when entered manually value is lower than allowed and max when it is greater than allowed. For example on focus lose or mouse click or even after some delay of not typing.

@sobayed
Copy link

sobayed commented Jun 25, 2018

I agree. When I saw the min/max parameters I assumed that the user inputs would be checked in some way. Allowing any input anyway kind of defeats the purpose (or at least make the forced check configurable).

@Austin-PAVrus
Copy link

Austin-PAVrus commented Oct 29, 2018

Me too. Trying solve it by making something like:

@app.callback(Output('agentT', 'value'),
[Input('agentT', 'value')],
[State('agentT', 'min'),
State('agentT', 'max')])
def check_agentT_value(val,min,max):
if val >= min or val<= max:
raise PreventUpdate
elif val<min:
return min
else:
return max

leads me to a failure of layout loading with no logs in the console...

Are there other ways to check the limits of a manual input? I have 46 numeric fields in my project...

@valentijnnieman
Copy link
Contributor

A fix is included in 0.37.0!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants