<?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 Sending data with onFormSubmit: data being sent only for existing contacts in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Sending-data-with-onFormSubmit-data-being-sent-only-for-existing/m-p/354351#M4397</link>
    <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to send data through my HB form using hidden fields. We're testing the form with my team and it seems like if the person hitting submit is already a HB contact, then the function inside onFormSubmit runs fine and we get an email with the data we want, but if the person isn't already a HB contact, we just get a regular email with the person's email address (which is the only non-hidden field in the form).&lt;BR /&gt;&lt;BR /&gt;Any idea what this could be?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll leave my code in the comments as it seems to mark my post as spam if I put it here.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 19:47:56 GMT</pubDate>
    <dc:creator>romidg</dc:creator>
    <dc:date>2020-07-14T19:47:56Z</dc:date>
    <item>
      <title>Sending data with onFormSubmit: data being sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Sending-data-with-onFormSubmit-data-being-sent-only-for-existing/m-p/354351#M4397</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to send data through my HB form using hidden fields. We're testing the form with my team and it seems like if the person hitting submit is already a HB contact, then the function inside onFormSubmit runs fine and we get an email with the data we want, but if the person isn't already a HB contact, we just get a regular email with the person's email address (which is the only non-hidden field in the form).&lt;BR /&gt;&lt;BR /&gt;Any idea what this could be?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll leave my code in the comments as it seems to mark my post as spam if I put it here.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 19:47:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Sending-data-with-onFormSubmit-data-being-sent-only-for-existing/m-p/354351#M4397</guid>
      <dc:creator>romidg</dc:creator>
      <dc:date>2020-07-14T19:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sending data with onFormSubmit: data being sent only for existing contacts</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Sending-data-with-onFormSubmit-data-being-sent-only-for-existing/m-p/354354#M4398</link>
      <description>&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 19:50:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Sending-data-with-onFormSubmit-data-being-sent-only-for-existing/m-p/354354#M4398</guid>
      <dc:creator>romidg</dc:creator>
      <dc:date>2020-07-14T19:50:56Z</dc:date>
    </item>
  </channel>
</rss>

