Ui_text_input retain last input - tricky to use the widget sometimes

I noticed that many Node-RED users get confused with the behaviour of the ui_text_input widget and I am not an exception. I am trying to find a solution for the issue below for almost 3 hours now without success.

The flow couldn't possibly be simpler.

I want to be able to input a string, a single letter for instance, then clear the input field by pressing the button and then entering the very same letter. The ui_text_input widget will not pass the value to the output if it is the same as the previous one.

Try for instance to type the letter "s" (then enter, tab or click somewhere), press the button and enter "s" again.


It fails.


I do understand this is the normal behaviour and it is well explained in the help text. However I still need to find a way to enter twice the same value in the widget. For my use case it is mandatory to keep the option If msg arrives on input, pass through to output checked.`

I am pretty sure I did use a similar pattern in the past without issues but could not find that flow (or maybe I did not test it thoroughly at that time).

Appreciate any advice.

Edit: forgot to add the flow. Bad day today.

[{"id":"8cf25508.674348","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"86c37831.cf5ab8","type":"ui_text_input","z":"8cf25508.674348","name":"","label":"Model","tooltip":"","group":"b576f57f.11e4a8","order":2,"width":"4","height":"1","passthru":true,"mode":"text","delay":"0","topic":"","x":630,"y":280,"wires":[["832d22de.a33a7"]]},{"id":"5855ce5a.b96a9","type":"ui_button","z":"8cf25508.674348","name":"Clear","group":"b576f57f.11e4a8","order":2,"width":"4","height":"1","passthru":true,"label":"Clear","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":310,"y":280,"wires":[["b5049be4.54e258"]]},{"id":"386187eb.2f61e8","type":"inject","z":"8cf25508.674348","name":"Empty string","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":170,"y":280,"wires":[["5855ce5a.b96a9"]]},{"id":"832d22de.a33a7","type":"function","z":"8cf25508.674348","name":"node.warn","func":"node.warn(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":280,"wires":[[]]},{"id":"b5049be4.54e258","type":"change","z":"8cf25508.674348","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":280,"wires":[["86c37831.cf5ab8"]]},{"id":"b576f57f.11e4a8","type":"ui_group","z":"","name":"G1","tab":"e9b8050b.d11088","order":1,"disp":false,"width":"4","collapse":false},{"id":"e9b8050b.d11088","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Unbelievable, it works perfectly when I change the delay from 0 ms to something else. I have no idea why I configured 0 in the first place. I will leave anyway this post here as this may be useful fro someone, some day (perhaps to myself).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.