Up until now, I had all my forms redirect after submission. However, now I have a form in a modal where the user is kept on the page after the form is submitted via AJAX (no redirect). The normal behavior is supposed to be that the confirmation message replaces the form if it's a new submission. However, this is not happening. The confirmation message is displaying above the form, as if it is an edit and not a new submission.
I unminified frontend-submission.js and found that
(t =
<div class="rwmb-confirmation${n ? "" : " rwmb-error"}">${t}</div>), c ? e.prepend(t) : e.replaceWith(t);
doesn't work because on a new submission the value of c is the string "false" and being a string, will always return as true. It would only be false if it were empty or a boolean type.
Also:
t = e.find("button[name=rwmb_submit]"),
n = e.find("button[name=rwmb_delete]"),
should be:
t = e.find('button[name="rwmb_submit"]'),
n = e.find('button[name="rwmb_delete"]'),
Quotes around the button names are missing. Even though it may work as is right now, it's incorrect not to use quotes.