# Table/Form Refresh

**URL:** <https://forums.knack.com/t/table-form-refresh/13301>\
**Category:** Get Answers\
**Created:** [October 26, 2022, 6:16pm UTC](https://forums.knack.com/t/table-form-refresh/13301 "2022-10-26T18:16:43Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![JarrodSevi20608](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@JarrodSevi20608](https://forums.knack.com/u/JarrodSevi20608)\
**Post date:** [October 26, 2022, 6:16pm UTC](https://forums.knack.com/t/table-form-refresh/13301/1 "2022-10-26T18:16:43Z")

</div>

I built an invoice using the Knack recipe and it works almost flawlessly, however, when I add a line item, the Asset column(s) doesn’t refresh. As you can see the Quantity (3) updates and the extended price ($90.00) updates, but the asset description does not. I must refresh the browser page for Asset columns to display. As a test, I added both the a Text Formula Field, as well as the root field. This isn’t device specific, as I’ve tried on desktop & a tablet with the same result. I really don’t want the answer to be to refresh the browser page every time an item is added. Thank you in advance for your expertise and advice!!

 ![screenshot](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/9/981b17d1ded1c0d57f2ede67d052d6f568a532f9.jpeg)

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [October 26, 2022, 9:30pm UTC](https://forums.knack.com/t/table-form-refresh/13301/2 "2022-10-26T21:30:51Z")

</div>

Hi @JarrodSevi20608 - This is one of the issues with having a form that adds a record embedded in the page rather than linking from a menu.

You have a few options.

1 - Refresh the page after each item added, not a great option and not one I’d recommend.  
2 - Add the form again and check the box to link it from a menu. Set the form as a modal popup and change the form submit to redirect to parent. This will reload the parent page on submission and pull through the connected values.  
3 - Add the below JavaScript so when you submit the form it reloads (fetches) the table.

> $(document).on(‘knack-form-submit.view\_xxx’, function(event, view, record) {  
> Knack.views[“view\_xxx”].model.fetch();  
> });

---

<div class="post-metadata">

**Author:** ![JarrodSevi20608](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@JarrodSevi20608](https://forums.knack.com/u/JarrodSevi20608)\
**Post date:** [October 26, 2022, 11:57pm UTC](https://forums.knack.com/t/table-form-refresh/13301/3 "2022-10-26T23:57:38Z")

</div>

@CarlHolmes Thank You! I opted for #2 for now. I greatly appreciate your advice!

---

<div class="post-metadata">

**Author:** ![Chris9](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@Chris9](https://forums.knack.com/u/Chris9)\
**Post date:** [November 14, 2022, 7:39pm UTC](https://forums.knack.com/t/table-form-refresh/13301/4 "2022-11-14T19:39:15Z")

</div>

How do I find the view number? [“view\_xxx”]

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [November 14, 2022, 10:23pm UTC](https://forums.knack.com/t/table-form-refresh/13301/5 "2022-11-14T22:23:16Z")

</div>

@Chris9 - From the Pages section of the builder, navigate to the page and click on the specific form component. The view number will be displayed in the URL address bar in your browser.

---

<div class="post-metadata">

**Author:** ![Calvin\_B](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/calvin_b/32/1897_2.png) [@Calvin\_B](https://forums.knack.com/u/Calvin_B)\
**Post date:** [November 20, 2022, 11:21pm UTC](https://forums.knack.com/t/table-form-refresh/13301/6 "2022-11-20T23:21:47Z")

</div>

YES!!! Thank you @CarlHolmes !!!  
I have always used option 2, but wondering how hard it would be to make a JS refresh option! (Still learning)  
I am implementing this in one of my apps right now!  
If I could press the heart 5 times I would!!!  
👍

---

<div class="post-metadata">

**Author:** ![Erik](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/erik/32/982_2.png) [@Erik](https://forums.knack.com/u/Erik)\
**Post date:** [January 16, 2023, 10:40pm UTC](https://forums.knack.com/t/table-form-refresh/13301/7 "2023-01-16T22:40:37Z")

</div>

Is there a way to add multiple view numbers to Knack.views[“view\_xxx”]?  
Or would you have to run this code snippet for each view you want to update?

In my instance, I would like to update three of six tables present on the page and not update the other tables (or the pivot tables that are on the page as well.)

---

<div class="post-metadata">

**Author:** ![Erik](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/erik/32/982_2.png) [@Erik](https://forums.knack.com/u/Erik)\
**Post date:** [January 16, 2023, 10:43pm UTC](https://forums.knack.com/t/table-form-refresh/13301/8 "2023-01-16T22:43:27Z")

</div>

Seems doing it this way works for multiple views…

```auto
$(document).on('knack-form-submit.view_1589', function(event, view, record) {
   Knack.views["view_1578"].model.fetch();
   Knack.views["view_1580"].model.fetch();
   Knack.views["view_1582"].model.fetch();
});

```

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [January 17, 2023, 6:38am UTC](https://forums.knack.com/t/table-form-refresh/13301/9 "2023-01-17T06:38:32Z")

</div>

That’s how I do it 👍

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [January 17, 2023, 11:04pm UTC](https://forums.knack.com/t/table-form-refresh/13301/10 "2023-01-17T23:04:44Z")

</div>

Hi guys,

I saw your post and it gave me the idea to integrate it to the KTL.  
I’ve just completed the release, and it works beautifully.

All you have to do is go in the Builder and add this flag to your **Form’s title** :  
**REFRESH\_VIEW=Purchases,Client Sales**

In this example, I have two parameters separated by commas that are the exact text or my tables to be updated in that scene. You can have as many as you need.

The code looks like this:

```auto
on view render any:
if (view.title.includes('REFRESH_VIEW'))
    ktl.views.addSubmitToViewRefresh(view);

--------

addSubmitToViewRefresh(view) {
    if (!view.title) return;
    var views = view.title.split('REFRESH_VIEW=');
    if (views.length !== 2) return;
    views = views[1].split(',');
    var foundViewIds = [];
    for (var i = 0; i < views.length; i++) {
        var viewTitle = views[i].trim();
        console.log('viewTitle =', viewTitle);
        var viewId = ktl.scenes.findViewWithTitle(viewTitle, true, view.key);
        if (viewId) {
            foundViewIds.push(viewId);
        }
    }

    if (foundViewIds.length) {
        $(document).on('knack-form-submit.' + view.key, () => {
            ktl.views.refreshViewArray(foundViewIds)
        })
    }
}

```

In the Builder:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/3/335cbabd9ca55ce4ce39e5ac29e470db0f9e2506.png)

You can learn how it’s made and see all the details in this file: **[KTL.js](https://github.com/cortexrd/Knack-Toolkit-Library/blob/master/KTL.js)**

Hope you like it, keep me informed!

Cheers,  
Normand

---

<div class="post-metadata">

**Author:** ![Erik](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/erik/32/982_2.png) [@Erik](https://forums.knack.com/u/Erik)\
**Post date:** [January 27, 2023, 2:47pm UTC](https://forums.knack.com/t/table-form-refresh/13301/11 "2023-01-27T14:47:33Z")

</div>

Fantastic. Can’t wait till a get a minute to play around with this…

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [January 27, 2023, 2:49pm UTC](https://forums.knack.com/t/table-form-refresh/13301/12 "2023-01-27T14:49:20Z")

</div>

Thanks Erik!

Just wait an hour or two, I’m doing some major simplification of the install process. The documentation is currently out of sync and I’m updating it now.

Will let you know asap.

Normand

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [January 27, 2023, 8:06pm UTC](https://forums.knack.com/t/table-form-refresh/13301/13 "2023-01-27T20:06:10Z")

</div>

Erik,

You may go see now, all is updated.  
Let me know what you like and don’t like. What you’d like to see added, changed or upgraded.

Cheers,  
Norm

---

<div class="post-metadata">

**Author:** ![Erik](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/erik/32/982_2.png) [@Erik](https://forums.knack.com/u/Erik)\
**Post date:** [January 27, 2023, 8:53pm UTC](https://forums.knack.com/t/table-form-refresh/13301/14 "2023-01-27T20:53:36Z")

</div>

I’m in the documentation now.  
Very cool.  
Thanks for sharing.  
I’ll give feedback as I’m able.

---

<div class="post-metadata">

**Author:** ![AlishaP95770](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/alishap95770/32/2036_2.png) [@AlishaP95770](https://forums.knack.com/u/AlishaP95770)\
**Post date:** [May 8, 2023, 2:45pm UTC](https://forums.knack.com/t/table-form-refresh/13301/15 "2023-05-08T14:45:48Z")

</div>

Nice Code!! Thank you. This helps alot!
