How to add two text box input to a functon

how to add two text box input(number) to a functon and addition of two nuber and display it in another text box

Can you be more clear ?

like this image

add

Textinput nodes send out messages when the value is changed.
In function node you should have two values stored in context and when msg comes in, change the value, and store it again, do the addition and send out calculated value.
To identify which value needed to be changed you will need to use msg.topic Set different topics for textinput nodes for this identification.

i am very new to this platform and i have no idea how to do this.if have the example code please send me it will be helpful for me

Wait sachin working. Will send you a very simplest flow.

Thank u sir....:pray:

sachin, Find this and import into your NodeRED.

[{"id":"fe1897ae.8d7678","type":"ui_template","z":"30effa47.d19706","group":"40586503.24038c","name":"","order":6,"width":0,"height":0,"format":"\n First number<input type="number" id="firstNumber">
\n Last number<input type="number" id="secondNumber">
\n\n<md-button ng-click="send({firstNumber:action1(),secondNumber:action2()})"> Set\n\n\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":360,"y":400,"wires":[["56315c97.cc31f4"]]},{"id":"56315c97.cc31f4","type":"function","z":"30effa47.d19706","name":"","func":"var firstnumber = msg.firstNumber;\nvar secondnumber = msg.secondNumber;\nvar sum = Number(Number(firstnumber)+Number(secondnumber));\nmsg.payload=sum;\nreturn msg;\n","outputs":1,"noerr":0,"x":560,"y":400,"wires":[["5e5ca7c4.ba4948","d8a81325.ab3d6"]]},{"id":"5e5ca7c4.ba4948","type":"ui_text","z":"30effa47.d19706","group":"40586503.24038c","order":7,"width":0,"height":0,"name":"","label":"Summation","format":"{{msg.payload}}","layout":"row-spread","x":780,"y":420,"wires":},{"id":"d8a81325.ab3d6","type":"debug","z":"30effa47.d19706","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":780,"y":360,"wires":},{"id":"40586503.24038c","type":"ui_group","z":"","name":"Default","tab":"fc483079.2a61f","disp":true,"width":"6","collapse":false},{"id":"fc483079.2a61f","type":"ui_tab","z":"","name":"Calculator","icon":"dashboard","disabled":false,"hidden":false}]

showing errorCapture2

[{"id":"48d454c3.8caffc","type":"ui_template","z":"9a07c8cc.9e9838","group":"40586503.24038c","name":"","order":6,"width":0,"height":0,"format":"\n First number<input type="number" id="firstNumber">
\n Last number<input type="number" id="secondNumber">
\n\n<md-button ng-click="send({firstNumber:action1(),secondNumber:action2()})"> Set\n\n\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":300,"y":260,"wires":[["faff4603.294c18"]]},{"id":"faff4603.294c18","type":"function","z":"9a07c8cc.9e9838","name":"","func":"var firstnumber = msg.firstNumber;\nvar secondnumber = msg.secondNumber;\nvar sum = Number(Number(firstnumber)+Number(secondnumber));\nmsg.payload=sum;\nreturn msg;\n","outputs":1,"noerr":0,"x":500,"y":260,"wires":[["b60f3e08.92dc8","73d2be7e.d1ed8"]]},{"id":"b60f3e08.92dc8","type":"ui_text","z":"9a07c8cc.9e9838","group":"40586503.24038c","order":7,"width":0,"height":0,"name":"","label":"Summation","format":"{{msg.payload}}","layout":"row-spread","x":720,"y":280,"wires":},{"id":"73d2be7e.d1ed8","type":"debug","z":"9a07c8cc.9e9838","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":720,"y":220,"wires":},{"id":"40586503.24038c","type":"ui_group","z":"","name":"Default","tab":"fc483079.2a61f","disp":true,"width":"6","collapse":false},{"id":"fc483079.2a61f","type":"ui_tab","z":"","name":"Calculator","icon":"dashboard","disabled":false,"hidden":false}]

same error

flow.json (1.8 KB)

Do this. May be formatting issue.

You have to put three ticks ``` ``` around your code otherwise it gets screwed up.

Blindly posting it again will not help.

yess thank you very much its working ....

this is my actual code .
1.when i press button color pad will popup and each color has different values .
2. i have to do addition of textbox value and color value .
3.then i have to place it into buffer.
flows (5).json (18.7 KB)
do you have any idea how to do this

What exactly you want to do with this ?

we have color sensor we have to send color values.
i want to publish that values over mqtt

Still can't figure out what you are talking. in your flow you have one color selector and one one text input box. to the right there is one more text box which is written with COLOR2. And a bunch of randomly connected nodes.

that one simplified code ...
they are 6 color box like that only.
if it is works for one color block ill add next 5 color block like that only
Capture
i want like this

Capture