Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Input component improvement: No callback if bad value and clear option

What bugs me about https://dash.plotly.com/dash-core-components/input

  • since input/output cannot both the value due circular loop, please add an auto_clear option to empty the input field when send/callback got triggered
  • issue 2: if type='number' and min=1, max=4, value=1, do Not trigger an update if the cell eg is empty eg if user deletes input alltogether. the minmaxvalue suggests only 1-4 are valid values.

Please comment

and it still does :smiley:

hi @2l3fij

I can’t comment on issue 1 since I’m not sure what you mean.

Regarding issue 2, I think the way it works now is correct. A callback is triggered when either a valid number is entered or it changes between valid and invalid.

In your example, when it starts, the value=1. If it’s deleted, then the value changes to None and a callback is fired. If it’s then changed to any number >4 or <1, , the value is still None, since it’s not in the valid range, and the callback does not fire. It only fires again when a number between 1 and 4 is entered.

This allows you to do something when an invalid number is entered - like send an error message.

issue 2: firing callback when falling out of range seems valid 'todo sth (also its red bordered and already indicated)

issue1 burns: since input and output can not be in the same callback, the value i cannot clear the field. The now submitted value remains and needs user manual clear to renter else; bad usability.