# What is the proper way to clear a dashboard form? Just send an empty array payload like for a table?

**URL:** <https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846>\
**Category:** General\
**Created:** [23 March 2023 02:20 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846 "2023-03-23T02:20:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [23 March 2023 02:20 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/1 "2023-03-23T02:20:03Z")

</div>

What is the proper way to clear a dashboard from? Just send an empty array payload like for a table?

msg.payload = [] for example?

---

<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:** [23 March 2023 14:07 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/2 "2023-03-23T14:07:54Z")

</div>

Do you mean a Form?

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [23 March 2023 16:48 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/3 "2023-03-23T16:48:06Z")

</div>

Useful information here - [How To Initial Form UI - #10 by dceejay](https://discourse.nodered.org/t/how-to-initial-form-ui/19180/10)

---

<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:** [23 March 2023 17:36 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/4 "2023-03-23T17:36:31Z")

</div>

You would feed a object of null values for each payload property of the form.  
e.g.

```auto
{"test1":null,"test2":null,"test3":null}

```

If the last form item is required it will show red.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [24 March 2023 07:20 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/5 "2023-03-24T07:20:25Z")

</div>

Yes a form not a 'from' of course. So you can't clear an entire form? You have to explicitly set each field to null, blank, whatever? Interesting. And yet, when you click the submit button, the form is cleared of course, it is such behavior I wanted to mimic. Maybe easier to just send message the cancel button initially to ensure the form is in a known state.

---

<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:** [24 March 2023 15:37 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/6 "2023-03-24T15:37:42Z")

</div>

You can do it with some custom front-end javascript:

```auto
const { myForm } = document.forms;
myForm.reset();

```

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [27 March 2023 13:45 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/7 "2023-03-27T13:45:09Z")

</div>

Ah! That is closer to what I was looking for! Slick. Thanks,

---

<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:** [10 April 2023 13:45 UTC](https://discourse.nodered.org/t/what-is-the-proper-way-to-clear-a-dashboard-form-just-send-an-empty-array-payload-like-for-a-table/76846/8 "2023-04-10T13:45:44Z")

</div>

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