# Clear prior dynamic output prior to view new one?

**URL:** <https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095>\
**Category:** Questions\
**Tags:** interface-construction, wolfram-cloud\
**Created:** [November 6, 2021, 10:11pm UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095 "2021-11-06T22:11:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjbr21](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/rjbr21/32/15912_2.png) [@rjbr21](https://community.wolfram.com/u/rjbr21)\
**Post date:** [November 6, 2021, 10:11pm UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/1 "2021-11-06T22:11:34Z")

</div>

This notebook works just fine. However, on sequential use of the “Submit” button the prior result remains and a new result is output below the old. How can I clear the prior output so that only the new output shows?

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/b09862be-6225-4ecf-83bc-06a3bd3e12df)

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [November 7, 2021, 10:08pm UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/2 "2021-11-07T22:08:13Z")

</div>

Hi Roger,

Is there a reason for using `Print` to show the output? Why not render the output as part of the UI? e.g.

 ![9726plot.png](https://global.discourse-cdn.com/wolfram/original/3X/f/f/ff98e8180498b780f2564ccae6df0c7ad1fed4e4.png)

The attached file has the code. There is a bug in `AccountingForm`, it does correctly format `Quantity` objects so instead, used a light red background for negative NPV.

[PropertyCalculator.nb](https://community.wolfram.com/uploads/short-url/oA8fuWCnEkdNdbUU2MCemOBbnur.nb) (21.2 KB)

---

<div class="post-metadata">

**Author:** ![rjbr21](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/rjbr21/32/15912_2.png) [@rjbr21](https://community.wolfram.com/u/rjbr21)\
**Post date:** [November 7, 2021, 10:42pm UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/3 "2021-11-07T22:42:04Z")

</div>

That would be just fine except it does not CloudDeploy. Is there a reason for this? I had not considered your method…

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [November 7, 2021, 11:58pm UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/4 "2021-11-07T23:58:57Z")

</div>

Well, it does `CloudDeploy`, however, four of the `InputField` report an error

> TypeError: Cannot read properties of undefined (reading ‘forEach’)

Observe that all of those fields have `Real` values, the ones that work have `Integer` values. This is most certainly a bug in `InputField` when type is `Number`. Change `Number` to `Expression` for those four and it works fine. You should probably add some error checking in case the user inputs a non-numeric value.

[Deployed version](https://www.wolframcloud.com/obj/0a9573f2-3276-4225-b697-1bfa46bc5b0d).

---

<div class="post-metadata">

**Author:** ![rjbr21](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/rjbr21/32/15912_2.png) [@rjbr21](https://community.wolfram.com/u/rjbr21)\
**Post date:** [November 8, 2021, 3:42am UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/5 "2021-11-08T03:42:19Z")

</div>

Thanks for solving my problem!!

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [November 8, 2021, 3:59am UTC](https://community.wolfram.com/t/clear-prior-dynamic-output-prior-to-view-new-one/19095/6 "2021-11-08T03:59:51Z")

</div>

You are welcome. BTW the URL to your website on your [profile page](https://community.wolfram.com/web/rjbr21) is incorrect. It should be [http://www.mathestate.com/](http://www.mathestate.com/)
