More formatting needed on inline thank you message

Status: Not Currently Planned

Status history

@CDarné - you can tweak my solution above to create a button within the thank you message. You’d just use basic JavaScript to add your elements and styles.

As a reminder, you need to use the embedded code version of your hubspot form within your site, and then the onFormSubmitted attribute to generate your callback function. This documentation goes into more depth on it: https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options

onFormSubmitted: function($form, data) {
 // setup targets for iframe doc
 const iBody = $form[0].closest("body");
 const iDoc = iBody.parentNode.parentNode;

 // Generate a button for whatever you want
 let formStyles = iDoc.createElement("style");
 let homeButton = iDoc.createElement("a");
 let message = iDoc.querySelector('.hbspt-form > .submitted-message');

 let styles = `
 .btn { 
 color: #fff; 
 display: block; 
 text-align: center; 
 margin: 10px auto; 
 padding: 10px 16px; 
 width: fit-content; 
 background: #f08605; 
 text-decoration: none; 
 font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; 
 }
 `;

 homeButton.setAttribute('href', 'https://www.google.com/');
 homeButton.classList.add('btn');
 homeButton.innerText = "Return to Google";

 formStyles.appendChild(iDoc.createTextNode(styles));
 iDoc.head.appendChild(formStyles);
 iDoc.body.appendChild(homeButton);
}