I have a requirement, to show a thank message and also download a file from another server, on form submission.
At present I have created a module in hubspot that display a form in a modal window. To download a file from another server I have added an external url to go after form submission. But doing this, I am not able to show a thank you page. Can anyone please suggest any way around for the same.
If I redirect it to a different thank you page and add a download button there, then is there anyway that user should not be able to acess that particular page (thank you page) without form submission.
Hello , thank you @coldrickjack for your response. Can you suggest if there is any possiblity that we could show an inline thank you page and download a file simultaneously?
One option you could consider is using the Forms API within your custom module. This would mean you have total control over the form pre and post submission logic. There would be no need to redirect to another page and you could just return the file to the user.
To answer your question relating to redirecting to a thank you page - there isn't really a way to prevent someone from accessing this if they wanted to. You could add the noindex and nofollow meta tags which would prevent it from being indexed. Another option is to create a smart rule on the page based on list membership. The list would have a filter for users who submitted the form. If the user is not on the list (and hasn't submitted the form) you can prompt them to submit the form otherwise assume they have converted and show the download link. The issue with this is it'll only work for contacts that are being tracked.
Another approach would be to create a script on the thank you page that would check to see if a user has submitted the form and if so continue otherwise redirect them back to the landing page (or show a message). Doing this would require a proxy server to interact with the HubSpot APIs as they don't support CORS.
In any event it'll mitigate the potential of someone downloading the file if they haven't submitted the form!