Hi there,
I've created a custom 'successful submission' page that should appear after a user has filled out and submitted a form. Now I need to create a redirect from a successfully completed form to that custom page.
The following code has been recommended to me, and it works whenever the user submits the form. The problem is that it works EVERY time, including when there are errors (e.g., required fields are blank) and the form is not actually submitted. That is, the user can 'submit' a blank form which is not actually sent, and they would still be redirected to the 'successful submission' page.
Can someone please recommend a way to redirect to the custom page only after the form is actually submitted?
<script>
if (document.referrer.match('/requests/new') && (window.location.href.indexOf("/requests/new?ticket_form_id=") === -1)) {
window.location.href = 'URL';
}
</script>
Thanks!