I built a fairly simple Arts db for my wife. One of the tables is for exhibits. She’s complaining that it takes too long to enter records. The whole point is to be able to easily and quickly enter a bunch of records. I’m using a modal add form which refreshes after each Submit. Is there a better (faster) way?
For me it would depend on how many fields you are filling in as to which method I’d choose. If there are a few fields then you could simply add the form to the same page as the table view and set the form redirect to automatically reload.
The same applies even in the modal popup situation you have. Instead of redirecting back to the parent you could set the form to automatically reload. The only issues with this is that when you eventually close the modal you’ll need to do a refresh if the table has a particular sort order as all new records will be at the bottom of the table.
It’s only a 3 fields. The modal is auto-reloading on submit.
Will putting the form on the page make it quicker?
The real problem is that Knack is using page refreshes. This should all be behind the scene AJAX functionality. But that aside, can it be made quicker?
Hello Peter,
We can add small javascript to fill all previous data into the refreshed form.
Regards,
Sunny Singla
Change the modal popup to display a “confirmation message”. Add the below JavaScript and change the view numbers. The first xxx is the modal add form view, the second xxx is your table view. The code will close the modal on submission, even though you have it set to just show a confirmation message. This will happen so quickly you won’t get a message. The second part of the code will refresh the data in your table without reloading the whole page.
$(document).on('knack-form-submit.view_xxx', function(event, view, record) {
Knack.views["view_xxx"].model.fetch();
});
Hi Sunny,
Not sure what you mean by “fill all previous data into the refreshed form” ?
I’ll try that Carl, thanks.
Hello Peter,
Like when you fill out the form and submit it clear the data. So you need to fill all forms again and again(for the same type of data with minor changes). But using javascript we can fill out the form again using previously submitted data.
So you can change as per your requirements.
also using this method we can fill any other record data as well. Like there are 100 records and you want to fill again same user data with few changes. Then we just click on records and we can autofill the form.
Regards,
Sunny Singla
ssingla1985@gmail.com
How can this work to refresh a detail view “under” the modal @CarlHolmes?
Carl
This was helpful, thanks. But on my page I have 3 views:
QUOTE HEADER - a details view … view_258
QUOTE LINE ITEMS - a grid view … view_289
ADD LINE ITEM - a form view … view_293
When I submit a new line item view_293 I want to refresh the grid view_289 and also refresh the header details view_258 (so the totals recalculate).
I tried the code below, adding a line in for the detail view hoping it might work, but it doesnt - the grid refreshes but not the details view. It appears that the model.fetch() doesn’t work with detail views?
Do you know what WOULD be the correct syntax on line 3 to refresh the detail view?
$(document).on(‘knack-form-submit.view_293’, function(event, view, record) {
Knack.views[“view_289”].model.fetch();
Knack.views[“view_258”].model.fetch();
});