Extend AutoValidator/Ignore errors

Active member

I want to automatically trigger a button/submit a form, which is using the XenForo AutoValidator.
However, I want to "catch" the error, so it does not show the error overlay it usually does if an error happens.

The aim is to hide the button, so that the "form confirmation" happens automatically and users do not need to click any button.

XenForo's obfuscated/minified JavaScript code makes it hard to find out what needs to be done to achieve this.
For the curious: The form I am handling is the Tfa/2FA form with the submit button.

XenForo developer

You can listen to the AutoValidationError event on the form and prevent default within that to stop the error overlay. To automatically trigger the form, you should just be able to call submit on it via JS.

Active member

Nice, this works!
Also thanks for the hint to the unmodified JS files. They are in the directory /full.
Just how do I now hide the AJAX loading indicator (#AjaxProgress) persistently? As it is automatically shown when an AJAX call is created, I cannot just use some CSS to do so.

Active member

Okay, so what I basically did is wrapping #AjaxProgress into a new div, which I then hide if necessary. As #AjaxProgress is only created when an AJAX request actually starts you need to listen for the event ajaxStart and c an then do the things you need to do.

However, if there are any better ideas, please fell free to share them.