Writing to file in csv format from input text in dashboard

Hello,
I am trying to make a flow that write the input texts in the dashboard to a file with csv format.
I am new to programming and I made this flow :

type or paste code here

I don't know how I can manage the msg.payload of the three input text in dashboard and save them in a file or append them to an existing file.
asdf.json (4.8 KB)

the file should be for example like this shape :
name1,familyname1,age1
name2,familyname2,age2
name3,familyname3,age3
and so on.

Why not use the ui-form node, it would be simpler and have more control on input fields and when it is submitted.
e.g.

[{"id":"365a165c.a92272","type":"change","z":"f8ec99b33c203710","name":"","rules":[],"action":"","property":"","from":"","to":"","reg":false,"x":155,"y":180,"wires":[["1023f232.58f71e"]],"l":false},{"id":"1023f232.58f71e","type":"ui_form","z":"f8ec99b33c203710","name":"","label":"","group":"6e33f3db.defabc","order":16,"width":0,"height":0,"options":[{"label":"Name","value":"name","type":"text","required":true,"rows":null},{"label":"Family Name","value":"family","type":"text","required":true,"rows":null},{"label":"Age","value":"age","type":"number","required":true,"rows":null}],"formValue":{"name":"","family":"","age":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","x":250,"y":180,"wires":[["a1a2482b.6b99c","365a165c.a92272"]]},{"id":"a1a2482b.6b99c","type":"template","z":"f8ec99b33c203710","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{{payload.name}}},{{{payload.family}}},{{{payload.age}}}","output":"str","x":480,"y":180,"wires":[["f83d4a7d53ad6e7c","cf435aea.907718"]]},{"id":"f83d4a7d53ad6e7c","type":"debug","z":"f8ec99b33c203710","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":180,"wires":[]},{"id":"cf435aea.907718","type":"file","z":"f8ec99b33c203710","name":"","filename":"/path/to/file.ext","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":630,"y":260,"wires":[[]]},{"id":"6e33f3db.defabc","type":"ui_group","name":"problems","tab":"8f03e639.85956","order":4,"disp":true,"width":"6","collapse":false},{"id":"8f03e639.85956","type":"ui_tab","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Hi @imanipourmeysam

This is the flow in your asdf.json file:

Imagine that the user types into the "name" field. The payload will flow to the csv node and on to the file node, but there is no value for "age" and "last name".

You need to wait until all three input fields have a value before processing.
One way to do that is with a Join node:

Notice that the Join node settings have "using the value of msg.topic as the key".
You have to set a unique msg.topic in each input node.

Use debug nodes to see the outputs of the Join and csv nodes.