Redirect after submit request
Answered-
Hi Carlos! I threw something together for this which should work for you. I didn't test this for many scenarios, so use this as an example and test it out to see if it works for you! You'll want to place this in your document_head.hbs:
<script>
It's not pretty at all, but it should get the job done. This will run whenever the url slug contains only a number, so it won't get caught by the ticket form id search value. Also, remember to replace "yoursubdomain" with your actual subdomain. If you use host-mapping, update the above snippet accordingly.
let ticketNumber = window.location.href.split('requests/').pop();
let ref = document.referrer
if (ref.match('https://yoursubdomain.zendesk.com/hc/yourlocale/requests/new') && ticketNumber.match(/^[0-9.]+$/)) {
window.location.href = 'https://yoursubdomain.zendesk.com/hc';
}
</script>If you run into any issues with this, let me know! -
Hi Greg ! thanks for the information. However, I'm not trying to not enter the new request page, instead I'm trying to redirect after the user submits a new request. So they should be able to fill the form and send it but immediately redirected to the home page. Does this make sense?
Thanks !
-
Yep, that's what the above code snippet will allow you to do!
-
Would you be able to provide the whole script with the formatting to allow it be to added to the standard hbs file?
-
Hi Matthew! I just updated my post to include the script tag...forgot to do that before. You should be all set to go now!
Please sign in to leave a comment.
5 Comments