Hey,
My app requires the user to input some values manually, which have some constraints: cannot be negative, min/max depend on other inputs, …
What I’d like to do is:
- Either the min/max arguments in dcc.Input vary dynamically with respect to other dcc.Input values (eg min input A = input B value / input C value) ;
- Either have a popup message (similar to what dcc.ConfirmDialogProvider does, but without the button, rather based on the input value) that tells the user the constraints of the input with dynamic values (same eg as before) .
What I have done
Couldnt manage first option. Any ideas?
Second option:
# Inside my app.layout:
dcc.Slider(id='T', min=0.25, max=5, marks={0.25:"3 months", 5:"5 years"}, step=0.25, value=3),
dcc.Input(id="dt", value=0.01, type='number'),
dcc.Input(id="dt_p", value=1, type='number'),
dcc.ConfirmDialogProvider(id="output-provider"),
# [...]
@app.callback(Output('output-provider', 'message'),
[Input('T', 'value'),
Input("dt", "value"),
Input("dt_p","value")])
def check_input(T, dt, dt_p):
if dt_p<0 or dt_p > (T/dt):
return f"dt_p cannot be lower than 0 or higher than {T/dt}"
Note that this example did compile with no error but did not work as intended: the popup message does not show up.
I hope it was clear. Thank you for your help!