title: How do I modify a Hubspot javascript form that is system generated
body: <p>I'm having an issue where I'm trying to extend a Hubspot form in their CMS to get some additional functionality out of it. </p>
  
  <p>Unfortunately I can not edit the code they have in the CMS so thought there might be a way to add some javascript after their code to add in what I want to do. </p>
  
  <p>The code they generate looks like this: </p>
  
  <pre><code>      hbspt.forms.create({ 
          portalId: '435515',
          formId: '19046100-d845-4f9c-96cf-974286fc6b45', 
        });
  </code></pre>
  
  <p>I'm wanting to grab the form data after submit so it needs to be like this:</p>
  
  <pre><code>      hbspt.forms.create({ 
          portalId: '435515',
          formId: '19046100-d845-4f9c-96cf-974286fc6b45',
          onFormSubmit: function($data) {
            console.log( $("input[name=firstname]").val() );
          }    
        });
  </code></pre>
  
  <p>But I can not edit the code they generate. Is there a way to add the onFormSubmit to this function without editing the code they are generating. </p>
  
  <p>So something like: (this doesn't work)</p>
  
  <pre><code>    //Their original code
      &lt;script&gt;    
        hbspt.forms.create({ 
          portalId: '435515',
          formId: '19046100-d845-4f9c-96cf-974286fc6b45',   
        });
      &lt;/script&gt; 
  
      //My added function
      &lt;script&gt; 
          onFormSubmit: function($data) {
            console.log( $("input[name=firstname]").val() );
          }          
      &lt;/script&gt;  
  </code></pre>
  
  <p>Thanks</p>