Apparently, if you use name="submit" in your submit button, form.submit() throws this error.
Does not work:
<input type="submit" name="submit" value="Save">
Does work:
<input type="submit" name="submitButton" value="Save">