<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sending data with onFromSubmit: data gets sent only for existing contacts in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/355176#M34871</link>
    <description>&lt;P&gt;Hi Wendy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked! Apparently using &lt;STRONG&gt;val()&lt;/STRONG&gt; doesn't fire the &lt;STRONG&gt;change()&lt;/STRONG&gt; function, so I just removed all the &lt;STRONG&gt;change()&lt;/STRONG&gt; and change the onFormReady to onFormSubmit like you said. Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jul 2020 08:36:48 GMT</pubDate>
    <dc:creator>romidg</dc:creator>
    <dc:date>2020-07-17T08:36:48Z</dc:date>
    <item>
      <title>Sending data with onFromSubmit: data gets sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354283#M34806</link>
      <description>&lt;P&gt;Hi there!&lt;BR /&gt;&lt;BR /&gt;I'm trying to send data through my HB form using hidden fields. We're testing the form with my team is it seems like the data gets sent for people that are already a HB contact, but for new contacts we just get an email with their email address (which is the only non-hidden field in the form).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why this is?&lt;BR /&gt;&lt;BR /&gt;Here's my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; hbspt.forms.create({
        portalId: "2961853",
        formId: "b9bc4c6d-ce95-4275-ac7c-1ca703211196",
        onFormSubmit: function($form) {
              const form = $form[0]
              const email = form[0].value
              const companySize = $('#slider')[0].value
              const paymentPeriod = annually.prop('checked') === true ? 'annually' : 'monthly'
              const currency = $('.currency')[0].innerHTML
              const total =  $('#final-price')[0].innerHTML
              const data = {
                  fields: [
                      {
                        name: "builder_company_size",
                        value: companySize
                      },
                      {
                        name: "builder_payment_period",
                        value: paymentPeriod
                      },
                      {
                        name: "builder_currency",
                        value: currency
                      },
                      {
                        name: "builder_price",
                        value: total
                      },
                      {
                        name: "email",
                        value: email
                      }
                    ],
                    legalConsentOptions: {
                      consent: { // Include this object when GDPR options are enabled
                        consentToProcess: true,
                        text: "I agree to allow Starred to store and process my personal data.",
                        communications: [
                          {
                            value: true,
                            subscriptionTypeId: 999,
                            text: "I agree to be contacted by Starred."
                          }
                        ]
                      }
                    }
                  }
                  $.ajax({
                    type: "POST",
                    url: 'https://api.hsforms.com/submissions/v3/integration/submit/2961853/b9bc4c6d-ce95-4275-ac7c-1ca703211196',
                    data: JSON.stringify(data),
                    success: 'success',
                    dataType: 'json',
                    contentType: 'application/json'
                  });
         }
});&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jul 2020 15:57:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354283#M34806</guid>
      <dc:creator>romidg</dc:creator>
      <dc:date>2020-07-14T15:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sending data with onFromSubmit: data gets sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354789#M34822</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/138586"&gt;@romidg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at your code, I do have a couple of clarification points:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Are you looking to use the&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank"&gt;Submit data for a form | Forms API&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank"&gt;How to customize the form embed code&lt;/A&gt;?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If you're looking to embed the form and use jquery to manipulate the form field data, you would need to implement something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  hbspt.forms.create({
	portalId: "portalId",
	formId: "form ID",
      onFormReady: function($form) {
      $form.find('input[name="builder_company_size"]').val(companySize).change();
                 $form.find('input[name="builder_payment_period"]').val(paymentPeriod).change();
         $form.find('input[name="builder_currency"]').val(currency).change();
         $form.find('input[name="builder_price"]').val(total).change();

     }
});&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 05:12:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354789#M34822</guid>
      <dc:creator>WendyGoh</dc:creator>
      <dc:date>2020-07-16T05:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sending data with onFromSubmit: data gets sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354829#M34831</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/66274" target="_self"&gt;Wendy&lt;/A&gt;, thanks for the reply. I implemented the code above, but the problem i have now is that is passes the values that are selected when you first go to the page (&lt;A href="https://www.starred.com/pricing-builder/" target="_blank" rel="noopener"&gt;https://www.starred.com/pricing-builder/&lt;/A&gt;) instead of the ones the user selects.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 09:12:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/354829#M34831</guid>
      <dc:creator>romidg</dc:creator>
      <dc:date>2020-07-16T09:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sending data with onFromSubmit: data gets sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/355121#M34861</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/138586"&gt;@romidg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is likely because on the code that I shared, I'm using the `onFormReady` event. If you'd like to change the value after submission, you'd need to use the `onFormSubmit` event.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To learn more about global form events, you may want to check out this documentation:&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/global-form-events?__hstc=20629287.62f23410abbf59eaae76981ea7423766.1593503833905.1593503833905.1593503833905.1&amp;amp;__hssc=20629287.51.1593495031708&amp;amp;__hsfp=1264359193" target="_blank"&gt;Using Global Form Events&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 02:36:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/355121#M34861</guid>
      <dc:creator>WendyGoh</dc:creator>
      <dc:date>2020-07-17T02:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sending data with onFromSubmit: data gets sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/355176#M34871</link>
      <description>&lt;P&gt;Hi Wendy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked! Apparently using &lt;STRONG&gt;val()&lt;/STRONG&gt; doesn't fire the &lt;STRONG&gt;change()&lt;/STRONG&gt; function, so I just removed all the &lt;STRONG&gt;change()&lt;/STRONG&gt; and change the onFormReady to onFormSubmit like you said. Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 08:36:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Sending-data-with-onFromSubmit-data-gets-sent-only-for-existing/m-p/355176#M34871</guid>
      <dc:creator>romidg</dc:creator>
      <dc:date>2020-07-17T08:36:48Z</dc:date>
    </item>
  </channel>
</rss>

