I am trying to clear an input_number data field in a dashboard so I don’t have to delete the previous value to enter a new one.
The only way I was able to do it is to set back the state to “null”.
It does work perfectly in the dev tools “set state” (was previously set to “777”):
But unfortunately, a script or automation won’t accept anything else than a float.
(below returns "expected float for dictionary value @ data[‘value’] " )
Since I have confirmation that the system can do it, is there a way to emulate the devtools, “force” a “null” value as a state, or revert the input_number to it’s “initial” value (which is also “null”).
@123 The data has to be to modifiable via the Dashboard.
The data field is a jukebox style field for guests to select songs from a playlist.
The input_text works for this purpose.
That would have been my first choice as well. The 0 serves as a visual cue, for the user, of what’s expected in that field. Given a list of numbered choices, 0 is an intuitive ‘non choice’. In addition, an Input Number automatically constrains the user’s input to a numeric value.
Now that you have switched to an Input Text, be sure to use its pattern option to restrict input to integers and an empty string (otherwise, by default, Input Text allows for any characters).
Thanks for the tips;
The “0” didn’t really feel intuitive.
Though it would accept “0123” as an input for 123, you didn’t know if you had to delete it or why it was there… Will test with guests and see how it goes.
l kept the previous code in case I change my mind …
Cheers.