<?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: localStorage conflicting with HubSpot form in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224823#M3719</link>
    <description>&lt;P&gt;Welcome, &lt;A class="mention" href="https://community.hubspot.com/u/seanfilidis"&gt;@seanfilidis&lt;/A&gt;!&lt;/P&gt;
&lt;P&gt;I'm glad to hear you found the solution so quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Nov 2018 17:46:26 GMT</pubDate>
    <dc:creator>IsaacTakushi</dc:creator>
    <dc:date>2018-11-08T17:46:26Z</dc:date>
    <item>
      <title>localStorage conflicting with HubSpot form</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224821#M3717</link>
      <description>&lt;P&gt;I have a script on our "Create Account" page. It looks for a "referral-id" parameter in the URL and puts the value into a hidden field in the HubSpot form on the page. The script has worked as expected, until now.&lt;/P&gt;
&lt;P&gt;I just updated the script to also store the value from the URL parameter in &lt;CODE&gt;window.localStorage&lt;/CODE&gt; so that if a user leaves the page and comes back, it will retain the referral id.&lt;/P&gt;
&lt;P&gt;The script works exactly as expected. The values are saved, and the hidden field is filled. However, the form no longer submits. Clicking submit merely does nothing. I get no console errors.&lt;/P&gt;
&lt;P&gt;Does anyone have any ideas as to what's going on? Do HubSpot forms not like it when localStorage is used?&lt;/P&gt;
&lt;P&gt;Here's the test page I'm working on: &lt;A href="https://www.instantmagazine.com/create-account-test" rel="nofollow noopener"&gt;https://www.instantmagazine.com/create-account-test&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="lang-auto"&gt;var params;
var referredBy;
var hiddenField;

function fillHiddenField() {
	hiddenField = document.getElementsByName("referred_by");
	hiddenField[0].setAttribute("value",referredBy);
}

params = new URLSearchParams(document.location.search.substring(1));

if (params.has("referral-id")) {
	referredBy = params.get("referral-id");
	setTimeout(fillHiddenField, 1000);
	window.localStorage.setItem("storeReferrer", referredBy);

} else if (window.localStorage.storeReferrer) {
	referredBy = window.localStorage.getItem("storeReferrer");
	setTimeout(fillHiddenField, 1000);
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks guys.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 08:37:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224821#M3717</guid>
      <dc:creator>spf</dc:creator>
      <dc:date>2018-11-07T08:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: localStorage conflicting with HubSpot form</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224822#M3718</link>
      <description>&lt;P&gt;Solved my own problem.&lt;/P&gt;
&lt;P&gt;Nothing was wrong with the script. The HubSpot property I was sending referral IDs to was a numeric field, and I was sending it IDs like "sean".&lt;/P&gt;
&lt;P&gt;Changing the HubSpot property to a single line text field fixed everything. &lt;IMG src="https://community.hubspot.com/legacyfs/online/emojis/apple/rofl.png?v=6" title=":rofl:" class="emoji" alt=":rofl:" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 13:35:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224822#M3718</guid>
      <dc:creator>spf</dc:creator>
      <dc:date>2018-11-07T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: localStorage conflicting with HubSpot form</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224823#M3719</link>
      <description>&lt;P&gt;Welcome, &lt;A class="mention" href="https://community.hubspot.com/u/seanfilidis"&gt;@seanfilidis&lt;/A&gt;!&lt;/P&gt;
&lt;P&gt;I'm glad to hear you found the solution so quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 17:46:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/localStorage-conflicting-with-HubSpot-form/m-p/224823#M3719</guid>
      <dc:creator>IsaacTakushi</dc:creator>
      <dc:date>2018-11-08T17:46:26Z</dc:date>
    </item>
  </channel>
</rss>

