# Send value of input text when click on button

**URL:** <https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015>\
**Category:** Dashboard\
**Created:** [11 April 2019 08:55 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015 "2019-04-11T08:55:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hebergeweb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hebergeweb/32/6394_2.png) [@hebergeweb](https://discourse.nodered.org/u/hebergeweb)\
**Post date:** [11 April 2019 08:55 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/1 "2019-04-11T08:55:29Z")

</div>

how to send value of input text when click on button?  
the message is sent directly when I enter a value on input text without clicking the button.

![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3649851521405c45d5684604e3a4154827a772a9.png)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [11 April 2019 09:21 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/2 "2019-04-11T09:21:30Z")

</div>

It goes like this.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/02f8f9032e75b3151899a1d058048e0d70ba70e2.png)

---

<div class="post-metadata">

**Author:** ![hebergeweb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hebergeweb/32/6394_2.png) [@hebergeweb](https://discourse.nodered.org/u/hebergeweb)\
**Post date:** [11 April 2019 10:30 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/3 "2019-04-11T10:30:27Z")

</div>

the code please!  
and i use _ui\_text\_input_ not _numeric_

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [11 April 2019 11:30 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/4 "2019-04-11T11:30:30Z")

</div>

The flow is in the cookbook  
[http://cookbook.nodered.org](http://cookbook.nodered.org)

but you should be able to recreate it just by reading the  
names of the change nodes

---

<div class="post-metadata">

**Author:** ![yaquikao](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yaquikao/32/23867_2.png) [@yaquikao](https://discourse.nodered.org/u/yaquikao)\
**Post date:** [13 June 2020 03:47 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/5 "2020-06-13T03:47:53Z")

</div>

Example Flow:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/2516a0cd179d045fb2cbf057c5b19e51dd806921.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74174e3da6d0c2af6d7ed9cfdd1ef58862cb2a6b.png)  
[{"id":"1b2fb300.c26e5d","type":"ui\_button","z":"81abceaf.740d","name":"","group":"1f48566b.e8958a","order":3,"width":0,"height":0,"passthru":false,"label":"Summit Button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":520,"y":680,"wires":[["49d75074.37303"]]},{"id":"49d75074.37303","type":"function","z":"81abceaf.740d","name":"A-B","func":"msg.a=global.get("a") ;\nmsg.b=global.get("b") ;\nmsg.payload = Number((msg.a-msg.b).toFixed(2));\n\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":680,"wires":[["21a1c9af.ba91a6"]]},{"id":"9f2f48ad.8f7838","type":"ui\_text\_input","z":"81abceaf.740d","name":"","label":"Number B","tooltip":"","group":"1f48566b.e8958a","order":2,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":500,"y":780,"wires":[["dec15280.3cbc6"]]},{"id":"dec15280.3cbc6","type":"function","z":"81abceaf.740d","name":"Store to Global Variable b","func":"global.set("b",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":780,"wires":[]},{"id":"1373611.8d85b9f","type":"inject","z":"81abceaf.740d","name":"Initial Value","topic":"","payload":"33","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":310,"y":740,"wires":[["29981141.09dd9e","9f2f48ad.8f7838"]]},{"id":"29981141.09dd9e","type":"ui\_text\_input","z":"81abceaf.740d","name":"","label":"Number A","tooltip":"","group":"1f48566b.e8958a","order":1,"width":"5","height":"2","passthru":true,"mode":"number","delay":300,"topic":"","x":500,"y":740,"wires":[["7894de12.4ed5f"]]},{"id":"7894de12.4ed5f","type":"function","z":"81abceaf.740d","name":"Store to Global Variable a","func":"global.set("a",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":740,"wires":[]},{"id":"21a1c9af.ba91a6","type":"ui\_text","z":"81abceaf.740d","group":"1f48566b.e8958a","order":4,"width":0,"height":0,"name":"","label":"Result","format":"{{msg.payload}} ","layout":"col-center","x":810,"y":680,"wires":},{"id":"1f48566b.e8958a","type":"ui\_group","z":"","name":"Group 1","tab":"7f1aa02d.2ce9","order":1,"disp":true,"width":"6","collapse":false},{"id":"7f1aa02d.2ce9","type":"ui\_tab","z":"","name":"Home","icon":"dashboard","order":1}]

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 June 2020 06:20 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/6 "2020-06-13T06:20:50Z")

</div>

Have you considered using the form node?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 June 2020 08:08 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/7 "2020-06-13T08:08:09Z")

</div>

Please read [this post](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) for how to share code on the forum so that it is importable. You should go to a new line and click the `</>` button then paste the code where it says.

---

<div class="post-metadata">

**Author:** ![RSURIAGA](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@RSURIAGA](https://discourse.nodered.org/u/RSURIAGA)\
**Post date:** [28 April 2021 14:45 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/8 "2021-04-28T14:45:11Z")

</div>

[quote="yaquikao, post:5, topic:10015"]

```auto
[{"id":"1b2fb300.c26e5d","type":"ui_button","z":"81abceaf.740d","name":"","group":"1f48566b.e8958a","order":3,"width":0,"height":0,"passthru":false,"label":"Summit Button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":520,"y":680,"wires":[["49d75074.37303"]]},{"id":"49d75074.37303","type":"function","z":"81abceaf.740d","name":"A-B","func":"msg.a=global.get("a") ;\nmsg.b=global.get("b") ;\nmsg.payload = Number((msg.a-msg.b).toFixed(2));\n\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":680,"wires":[["21a1c9af.ba91a6"]]},{"id":"9f2f48ad.8f7838","type":"ui_text_input","z":"81abceaf.740d","name":"","label":"Number B","tooltip":"","group":"1f48566b.e8958a","order":2,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":500,"y":780,"wires":[["dec15280.3cbc6"]]},{"id":"dec15280.3cbc6","type":"function","z":"81abceaf.740d","name":"Store to Global Variable b","func":"global.set("b",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":780,"wires":[]},{"id":"1373611.8d85b9f","type":"inject","z":"81abceaf.740d","name":"Initial Value","topic":"","payload":"33","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":310,"y":740,"wires":[["29981141.09dd9e","9f2f48ad.8f7838"]]},{"id":"29981141.09dd9e","type":"ui_text_input","z":"81abceaf.740d","name":"","label":"Number A","tooltip":"","group":"1f48566b.e8958a","order":1,"width":"5","height":"2","passthru":true,"mode":"number","delay":300,"topic":"","x":500,"y":740,"wires":[["7894de12.4ed5f"]]},{"id":"7894de12.4ed5f","type":"function","z":"81abceaf.740d","name":"Store to Global Variable a","func":"global.set("a",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":740,"wires":[]},{"id":"21a1c9af.ba91a6","type":"ui_text","z":"81abceaf.740d","group":"1f48566b.e8958a","order":4,"width":0,"height":0,"name":"","label":"Result","format":"{{msg.payload}} ","layout":"col-center","x":810,"y":680,"wires":},{"id":"1f48566b.e8958a","type":"ui_group","z":"","name":"Group 1","tab":"7f1aa02d.2ce9","order":1,"disp":true,"width":"6","collapse":false},{"id":"7f1aa02d.2ce9","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1}]

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [28 April 2021 14:52 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/9 "2021-04-28T14:52:40Z")

</div>

@RSURIAGA Thanks for formatting the code, however this topic is almost a year old, and is not really necessary.  
I'm closing the topic for now.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [28 April 2021 14:52 UTC](https://discourse.nodered.org/t/send-value-of-input-text-when-click-on-button/10015/10 "2021-04-28T14:52:51Z")

</div>


