# How to save to file from forms

**URL:** <https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579>\
**Category:** General\
**Created:** [15 April 2023 07:13 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579 "2023-04-15T07:13:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PawelTolo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paweltolo/32/78591_2.png) [@PawelTolo](https://discourse.nodered.org/u/PawelTolo)\
**Post date:** [15 April 2023 07:13 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/1 "2023-04-15T07:13:18Z")

</div>

Hello,  
Can anyone please help with one problem.  
I want to save values from ui-form`s to file, and when i insert new value from form A , value from form B will stay unchanged. Can anyone help with function/flow ? Later i want to read from file and use these value as a global  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fa08e44f6f8bd50193d321471f07596c0b0c222b.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [15 April 2023 07:56 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/2 "2023-04-15T07:56:38Z")

</div>

Why not have one form that keeps its values.  
e.g.

```auto
[{"id":"c6319a103f275834","type":"ui_form","z":"65617ffeb779f51c","name":"","label":"","group":"2d4fe667.28f8ba","order":23,"width":0,"height":0,"options":[{"label":"value a","value":"q","type":"text","required":true,"rows":null},{"label":"value b","value":"b","type":"text","required":true,"rows":null}],"formValue":{"q":"","b":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":190,"y":3780,"wires":[["6850302ade08b95c","db10faec44b52d10"]]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false,"className":""},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

[How to import a flow](https://nodered.org/docs/user-guide/editor/workspace/import-export)

---

<div class="post-metadata">

**Author:** ![PawelTolo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paweltolo/32/78591_2.png) [@PawelTolo](https://discourse.nodered.org/u/PawelTolo)\
**Post date:** [15 April 2023 09:04 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/3 "2023-04-15T09:04:27Z")

</div>

Case is that i need few separate forms....

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 April 2023 10:28 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/4 "2023-04-15T10:28:22Z")

</div>

You need a context variable that collects all of the form inputs. Then when a msg arrives, you will need to get the context variable, update the appropriate property of the variable and then set the variable with the new data.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [15 April 2023 10:54 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/5 "2023-04-15T10:54:28Z")

</div>

Or a join node and feed forms back to the join and use msg.complete to submit the changes

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 June 2023 10:54 UTC](https://discourse.nodered.org/t/how-to-save-to-file-from-forms/77579/6 "2023-06-14T10:54:43Z")

</div>

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