I have followed your instructions to the letter (and removed the previous code of appending tabs) - I get a very quick flashup of a “404 Page Not Found” when the form is submitted as it returns to the table view.
My submit rule is set to “return to existing page” as if I set it to show confirmation message then I get the 404 as a permanent page.
I have carbon copied your code, just replacing the “table” with “tab”:
I have found a curve ball - hopefully your magic will work around it?
If you have a connection on the form being submitted and you allow for that forms connections to have a “add new” popup - that triggers the JS to act before the proper form is complete:
Hey Tim,
Found a glitch - can it be worked around?
If a user misses a compulsory field and still clicks “submit” then the page switches from the form to the table and the error/warning message is missed. You only realise when you see no entry in the table and go back to look at the form.