Hey guys! I have a problem with submitting a form in JavaScript with Neos. Submitting the form via the button works, the hash in the URL changes and I get the confirmation.
Using “document.querySelector(’#contact-form’).submit();” on the same form: Refreshes the page with the correct URL hash but I get no confirmation message and the form doesn’t change.
Is there anything I am missing here? I am using a very simple form (like the one described in the official How-To).
That is required in order to allow next and previous buttons that both submit the form and jump to the corresponding page.
If you just submit the form via JS, the __currentPage will not be sent and you stay on the first form page.
You could send the form via sth like document.querySelector('#contact-form .next .btn').click() or – if there is only one page – by adding a hidden field that sets __currentPage to 1