Refreshing an "Insert Record" form without reloading the page

I know there are a few threads about this sort of thing already (e.g. here, here, here, and here). However, I haven't been able to make use of them.

As others in those threads have suggested, Knack.views.view_XX.model.fetch() works perfectly for tables, but not for forms.

My set up:

On a main page, I have a table of classrooms, with an empty "Insert Record" form (let's call it view_1) directly below. When submitted (by clicking "Add Classroom"), that form creates a classroom record and then redirects to a modal pop-up child page, wherein the user can edit the just-created classroom, add teachers, etc. Using the .fetch() command, I can capture all these changes in the table of classrooms without having to reload the page. Here's the builder preview of that table and empty form below.

And here's what the pop-up page contains:

What should happen

When the user closes this pop-up page (which I trigger after submission of the empty Close Form & Refresh Classroom List form), they should be able to again hit the "Add Classroom" button to insert another classroom, redirect to the pop-up child page, etc. And if they refresh the main page first, before clicking the "Add Classroom" button, then this works as expected. However, we're trying to do this WITHOUT refreshing the page.

The Issue

If they DON'T refresh the page before clicking "Add Classroom", then a new classroom record isn't created. Instead, the previously created classroom info is pre-populated in the pop-up! It's as if the "Add Classroom" form needs to be reset, but I can't figure out how to do this.

What I've tried:

  • using the JavaScript's .reset() function on view_1, both before and after closing the pop-up: $('#view_1 form')[0].reset();
  • adding a .fetch() command before and after the above .reset() command.
  • clearing the hidden “add-classroom_id” input that appears on view_1 when the first classroom is added.

If I could figure out what happens to the "Add Classroom" form when the browser page is refreshed, maybe I can replicate that via code without refreshing the page.