I tried to embed this form in a new template but it is not showing up!
I'm pretty sure I used the right syntax for the function
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script> <script> hbspt.forms.create({ region: "na1", portalId: "3221062", formId: "1e1d64cd-9d70-4edf-a9f7-36d26a086059", inlineMessage: 'You are being redirected to your sign in page...', onFormSubmit: function($form){
var companyName = $form.find('input[company="FieldID"]').val(); setTimeout( function() { window.location.href = "https://" + encodeURIComponent( companyName ) + "rhonda.ai/accounts/login"; }, 500 ); // Redirects to url with query string data from form fields after 1/2 second.
var companyName = $form.find('input[name="company"]').val();
So your complete could shoud be:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "3221062",
formId: "1e1d64cd-9d70-4edf-a9f7-36d26a086059",
inlineMessage: 'You are being redirected to your sign in page...',
onFormSubmit: function($form){
var companyName = $form.find('input[name="company"]').val();
console.log('tesdt' + companyName);
setTimeout( function() {
window.location.href = "https://" + encodeURIComponent( companyName ) + "rhonda.ai/accounts/login";
}, 500 ); // Redirects to url with query string data from form fields after 1/2 second.
}
});
</script>
Perhaps the windows.location.href sould also be changed since if I will fill in the company 'HubSpot' my returning value will be: https://HubSpotrhonda.ai/accounts/login . Do you want it to be a subdomain? Than you should change the JS and add a . (dot) so you code will be: