You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Input 'number' with min and max not checking manual input #173
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.
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).
@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...
Activity
sobayed commentedon 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 commentedon 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 commentedon Nov 5, 2018
A fix is included in
0.37.0!