<?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: Set form field value with Jquery not working in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/380351#M4840</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/148742"&gt;@btfrost&lt;/a&gt;&amp;nbsp; thank you for sharing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
    <pubDate>Tue, 20 Oct 2020 20:26:23 GMT</pubDate>
    <dc:creator>PamCotton</dc:creator>
    <dc:date>2020-10-20T20:26:23Z</dc:date>
    <item>
      <title>Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/276280#M2889</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 prepopulate a field on a HS form with JQuery (everything lives on a Vue app).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have &lt;A href="https://integrate.hubspot.com/t/passing-custom-form-data-to-a-hubspot-form-in-hidden-field/8861/2" target="_self"&gt;read a topic&lt;/A&gt; that explicitely says that the value change should be chained with a ".change()" method.&lt;BR /&gt;&lt;BR /&gt;I've done that and, for debug puposes, I'm pre-populating the form on "hsFormCallback[onFormReady]" event. So that when I launch the page, the field is populated with my value. So far so good. Here is the code I'm using :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var score_global = $("input[name='score_global']");

score_global.val(123).trigger('change');&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I enter some text, in any other field available on the form, the prepopulated value disappears. It seems as if the&amp;nbsp;&lt;EM&gt;hsforms&lt;/EM&gt; script doesn't refresh with the trigger('change') (it does the same if I use .change() instead).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can anyone guide me here, I don't know what to attempt now?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 01:14:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/276280#M2889</guid>
      <dc:creator>Jice-Lavocat</dc:creator>
      <dc:date>2019-06-21T01:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278201#M2929</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/53043"&gt;@Jice-Lavocat&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having trouble replicating this behavior in my own account. Can you give me a link to the page in question so that I can take a closer look?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 18:57:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278201#M2929</guid>
      <dc:creator>Derek_Gervais</dc:creator>
      <dc:date>2019-07-01T18:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278282#M2931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/142"&gt;@Derek_Gervais&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I eventually managed to fix the problem. The issue originates from a depency issue on JQuery for the hubspot form.js script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To fix that in my Vue.Js app, I had to add the following lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Needed by Vue.JS for using Jquery inside the app
import JQuery from 'jquery'
let $ = JQuery

// Needed by Hubspot Form.js
window.jQuery = window.jQuery || JQuery&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 07:24:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278282#M2931</guid>
      <dc:creator>Jice-Lavocat</dc:creator>
      <dc:date>2019-07-02T07:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278413#M2932</link>
      <description>&lt;P&gt;That's awesome, thanks for posting your solution here!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 14:56:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/278413#M2932</guid>
      <dc:creator>Derek_Gervais</dc:creator>
      <dc:date>2019-07-02T14:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/380146#M4837</link>
      <description>&lt;P&gt;If anyone's interested in solving this without jquery...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;value &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; value&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;input.&lt;/SPAN&gt;&lt;SPAN&gt;dispatchEvent&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN&gt; Event(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;input&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt; &lt;SPAN&gt;bubbles&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;true&lt;/SPAN&gt; &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 20 Oct 2020 12:23:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/380146#M4837</guid>
      <dc:creator>btfrost</dc:creator>
      <dc:date>2020-10-20T12:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set form field value with Jquery not working</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/380351#M4840</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/148742"&gt;@btfrost&lt;/a&gt;&amp;nbsp; thank you for sharing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 20:26:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Set-form-field-value-with-Jquery-not-working/m-p/380351#M4840</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2020-10-20T20:26:23Z</dc:date>
    </item>
  </channel>
</rss>

