<?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: Embedded Form: Populating form fields in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/285044#M13209</link>
    <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/11566"&gt;@dranreb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you provide a live test site for us to look at?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At a glance though there might be a few things you can check:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Is the value of the target input name attribute actually "firstname"? If not the script will not be targeting the correct input, and might not send an error.&lt;/LI&gt;
&lt;LI&gt;Does the site you're embedding the form into have jQuery loaded? Without jQuery your $('input… will not function. You could try &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName" target="_self"&gt;plain ol' javascript&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Your script might be attempting to run before jQuery is ready or the form is even loaded. Try wrapping the function to update the value in a &lt;A href="https://learn.jquery.com/using-jquery-core/document-ready/" target="_self"&gt;documnet ready function&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Is the .change() method necessary at this point?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 13:32:59 GMT</pubDate>
    <dc:creator>Kevin-C</dc:creator>
    <dc:date>2019-08-08T13:32:59Z</dc:date>
    <item>
      <title>Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/284953#M13205</link>
      <description>&lt;P&gt;I would like to populate form fields with values via the form embed code. The below code, as recommended, does not work and no errors are generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great to get some idea about what's the issue here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resources I've checked and followed:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank"&gt;https://developers.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Hubspot-form-programmatically-set-field-value-via-jQuery/td-p/233247" target="_blank"&gt;https://community.hubspot.com/t5/APIs-Integrations/Hubspot-form-programmatically-set-field-value-via-jQuery/td-p/233247&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://mikemcbrien.com/hubspot-embedded-form-onformready-onformsubmit/" target="_blank"&gt;https://mikemcbrien.com/hubspot-embedded-form-onformready-onformsubmit/&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.hubspot.com/manipulating-forms-with-jquery" target="_blank"&gt;https://developers.hubspot.com/manipulating-forms-with-jquery&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;!--[if lte IE 8]&amp;gt;&lt;BR /&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;![endif]--&amp;gt;&lt;BR /&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;hbspt.forms.create({&lt;BR /&gt;portalId: "XXXX",&lt;BR /&gt;formId: "XXXX",&lt;BR /&gt;onFormSubmit: function($form, ctx){&lt;BR /&gt;$('input[name="firstname"]').val('Brian').change();&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 06:27:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/284953#M13205</guid>
      <dc:creator>dranreb</dc:creator>
      <dc:date>2019-08-08T06:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/285044#M13209</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/11566"&gt;@dranreb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you provide a live test site for us to look at?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At a glance though there might be a few things you can check:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Is the value of the target input name attribute actually "firstname"? If not the script will not be targeting the correct input, and might not send an error.&lt;/LI&gt;
&lt;LI&gt;Does the site you're embedding the form into have jQuery loaded? Without jQuery your $('input… will not function. You could try &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName" target="_self"&gt;plain ol' javascript&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Your script might be attempting to run before jQuery is ready or the form is even loaded. Try wrapping the function to update the value in a &lt;A href="https://learn.jquery.com/using-jquery-core/document-ready/" target="_self"&gt;documnet ready function&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Is the .change() method necessary at this point?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:32:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/285044#M13209</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2019-08-08T13:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/285232#M13218</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/11566"&gt;@dranreb&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;I think issue is not in code as there is no error but as i can see you have changed value on submit event it should be as soon as form renders. can you please check it after adding below code..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;!--[if lte IE 8]&amp;gt;
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
hbspt.forms.create({
portalId: "XXXX",
formId: "XXXX",
onFormReady: function($form){
$('input[name="firstname"]').val('Brian').change();
}
});
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Mark this as a solution if it helps !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 05:12:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/285232#M13218</guid>
      <dc:creator>Designer_WOT</dc:creator>
      <dc:date>2019-08-09T05:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286682#M13304</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your speedy reply and apologies for my delayed response. I was away.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a like to a page on an external Wordpress site - &lt;A href="https://bit.ly/30hY5uD" target="_blank"&gt;https://bit.ly/30hY5uD&lt;/A&gt;. Password is "hs".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Yes, the value exist in the form on the page.&amp;nbsp; The script also works on HubSpot pages but not externally.&lt;/LI&gt;&lt;LI&gt;Yes, I've doubled checked this and jQuery is loaded.&lt;/LI&gt;&lt;LI&gt;I'm not sure how to execute this task. It would be great if you could help give some guidance on how to do this.&lt;/LI&gt;&lt;LI&gt;I just copied that HubSpot shared. However, I've also read in the shared links that it's necessary.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&amp;lt;!--[if lte IE 8]&amp;gt;
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;
&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
hbspt.forms.create({
portalId: "XXXX",
formId: "XXXX",
onFormReady: function($form){
$('input[name="firstname"]').val('Brian').change();
}
});
&amp;lt;/script&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:54:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286682#M13304</guid>
      <dc:creator>dranreb</dc:creator>
      <dc:date>2019-08-19T09:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286684#M13305</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/74284"&gt;@Designer_WOT&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your speedy reply and apologies for my delayed response. As shared above, I was away.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both my code and yours works on HubSpot pages but not on external sites. jQuery is loaded etc. I'm really out of ideas here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help you could offer.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:57:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286684#M13305</guid>
      <dc:creator>dranreb</dc:creator>
      <dc:date>2019-08-19T09:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286715#M13309</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/11566"&gt;@dranreb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just got back to this. After checking the console I'm seeing a few errors happening.&lt;/P&gt;
&lt;P&gt;Most notably the "&lt;STRONG&gt;&lt;SPAN class="message-body-wrapper"&gt;&lt;SPAN class="message-flex-body"&gt;&lt;SPAN class="message-body devtools-monospace"&gt;ReferenceError: $ is not defined&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;". From some research I found that WP uses a function to prevent naming conficts, meaning that to use jQuery you mush refer to it as "&lt;STRONG&gt;jQuery&lt;/STRONG&gt;…" rather than the "&lt;STRONG&gt;$&lt;/STRONG&gt;…" in your functions. &lt;A href="https://stackoverflow.com/questions/3931529/is-not-a-function-jquery-error" target="_self"&gt;See this article.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another quick way to check if this is required is by using the dev tools console and tyoing "$().jquery" if this doesn't work it means that you must use the other method to write jQuery. Try using "&lt;SPAN class="message-body-wrapper"&gt;&lt;SPAN class="message-flex-body"&gt;&lt;SPAN class="message-body devtools-monospace"&gt;&lt;SPAN class="cm-variable"&gt;jQuery&lt;/SPAN&gt;().&lt;SPAN class="cm-property"&gt;jquery&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;". &lt;A href="https://youtu.be/I96NOilW6pQ" target="_self"&gt;See this video&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See image below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screeenshot - 2019-08-19 at 8.44.52 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/19283i77291B76DD380DA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screeenshot - 2019-08-19 at 8.44.52 AM.png" alt="Screeenshot - 2019-08-19 at 8.44.52 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see that I first attempted to run exactly your code, and got the same error that happened on load.&lt;/P&gt;
&lt;P&gt;Then you can see that I changed the "&lt;STRONG&gt;$&lt;/STRONG&gt;" to "&lt;STRONG&gt;jQuery&lt;/STRONG&gt;" and ran it again, and boom it seemed to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TL;DR&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Wordpress prevents jQuery naming conflicts by requiring you use a "&lt;STRONG&gt;jQuery&lt;/STRONG&gt;" in place of the usual "&lt;STRONG&gt;$&lt;/STRONG&gt;". To use jQuery you must follow this convention.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this gets you going in the right direction. For what ever reason if you need to update the values outside of the embbed snippet please reach out!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 13:03:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/286715#M13309</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2019-08-19T13:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/287053#M13330</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;&amp;nbsp;is correct - your issue is that WordPress loads jQuery in safe-mode which keeps other libraries from using the $ shorthand from colliding the the global namespace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But - you shouldn't actually need to make a new collection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The $form argument of the callback is actually a jQuery collection of the entire &amp;lt;form&amp;gt; element.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So instead of:&lt;/P&gt;&lt;PRE&gt;$('input[name="firstname"]').val('Brian').change();&lt;/PRE&gt;&lt;P&gt;You can do the following:&lt;/P&gt;&lt;PRE&gt;$form.find('input[name="firstname"]').val('Brian').change();&lt;/PRE&gt;&lt;P&gt;That should also be a bit more stable - because there could be a scenario where there are mulitple inputs with the same name on the page - and if that were to happen -&amp;nbsp;$('input[name="firstname"]') would return a collection of more than 1 element which would be problematic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:53:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/287053#M13330</guid>
      <dc:creator>derekcavaliero</dc:creator>
      <dc:date>2019-08-20T19:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/287139#M13343</link>
      <description>&lt;P&gt;Many thanks&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2599"&gt;@derekcavaliero&lt;/a&gt;! Your suggestion works. Also thanks for your time and assistance, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;. You guys are awesome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 06:57:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/287139#M13343</guid>
      <dc:creator>dranreb</dc:creator>
      <dc:date>2019-08-21T06:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/304579#M14420</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we apply same form field value changes on External CMS (Kentico) LP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing the same code but not updating the form field's value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You!!&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 07:42:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/304579#M14420</guid>
      <dc:creator>amitkumarsingh</dc:creator>
      <dc:date>2019-11-28T07:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/304985#M14469</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/111053"&gt;@amitkumarsingh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless your implementation of Kentico is using some sort of front-end like React or Vue - I don't see why this wouldn't work. A couple things to check:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Make sure you have the jQuery library included on your page.&lt;/P&gt;
&lt;P&gt;2. Check the JS console for errors - send a screenshot through with anything that may appear there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you have links to the page - share it and I can look into why it may not be working.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 12:46:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/304985#M14469</guid>
      <dc:creator>derekcavaliero</dc:creator>
      <dc:date>2019-12-02T12:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322438#M15574</link>
      <description>&lt;P&gt;This worked! Thank you soooo much!&lt;BR /&gt;&lt;BR /&gt;My issue was that I was imputting a script into wordpress where I would grab the utm params from the url and then input them into the hidden fields in the form they would eventually nav to.&lt;BR /&gt;&lt;BR /&gt;My error at first was that, inside my onFormReady($form) function, I could not use&amp;nbsp; $('input[name="firstname"]').val('Sue').change() because apparently Wordpress does something weird with jQuery where I couldn't use the $ because it would throw an error that t doesn't recognize the $.&lt;BR /&gt;&lt;BR /&gt;So then I used jQuery&amp;nbsp;('input[name="firstname"]').val('Sue').change(), which ran without an error, but did not actually change the value of the input.&lt;BR /&gt;&lt;BR /&gt;I then tried document.querySelector('input[name="firstname"]').setAttribute('value', 'Sue'), to manually change it, which worked SOMETIMES when testing in the console, but not in the code. It would return null as if the element did not exist, which I could see in the HTML, it definitely did exist.&lt;BR /&gt;&lt;BR /&gt;Then I used the code you suggested and it worked. Thank you so much!&lt;BR /&gt;&lt;BR /&gt;$form.find('input[name="firstname"]').val('Sue').change();&lt;BR /&gt;&lt;BR /&gt;How did you come up with this solution? How did you know to use the find method on $form? Did you manually sift through the $form available methods? I tried for a little bit but it was so cluttered w data I didn't know how to zero in on the methods and test each one.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks a bunch &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 18:04:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322438#M15574</guid>
      <dc:creator>joanna_cm</dc:creator>
      <dc:date>2020-02-27T18:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322765#M15587</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/122202"&gt;@joanna_cm&lt;/a&gt;&amp;nbsp;You can learn a lot about how to extend the core form functionality by reading the docs here:&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank"&gt;https://developers.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;CODE&gt;$form&lt;/CODE&gt; argument passed into the &lt;CODE&gt;onFormReady()&lt;/CODE&gt; and &lt;CODE&gt;onFormSubmit()&lt;/CODE&gt; callbacks are jQuery collections:&amp;nbsp;&lt;A href="https://learn.jquery.com/using-jquery-core/jquery-object/" target="_self"&gt;https://learn.jquery.com/using-jquery-core/jquery-object/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;CODE&gt;.find()&lt;/CODE&gt; method is part of the overall jQuery library - it acts as a "sub-query" on an existing jQuery collection. Since the &lt;CODE&gt;$form&lt;/CODE&gt; object returns a collection of the &lt;CODE&gt;&amp;lt;form&amp;gt;&lt;/CODE&gt; element you can search through it using &lt;CODE&gt;.find()&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason your other approaches were not working probably had to do with not using the callbacks - since the form is added to the page using JavaScript - you need to make sure you prefill the fields only AFTER the form has been added into the DOM (&lt;CODE&gt;onFormReady()&lt;/CODE&gt; is perfect for that scenario).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both the &lt;CODE&gt;onFormReady()&lt;/CODE&gt; and &lt;CODE&gt;onFormSubmit()&lt;/CODE&gt; callbacks require jQuery to function (which makes sense since the &lt;CODE&gt;$form&lt;/CODE&gt; argument is a jQuery collection).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 16:14:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322765#M15587</guid>
      <dc:creator>derekcavaliero</dc:creator>
      <dc:date>2020-02-28T16:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322793#M15588</link>
      <description>&lt;P&gt;Thank yo for the reply! All great resources.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I attempted all those approaches within the onFormReady($form) function but no dice.&lt;BR /&gt;&lt;BR /&gt;According to some other forums I read, it is a thing with Wordpress that it does not allow the use of $ to avoid messing with their global variables. I am not really sure why jQuery() did not work in it's place. I was likely not using it correctly. Thanks again.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 17:18:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/322793#M15588</guid>
      <dc:creator>joanna_cm</dc:creator>
      <dc:date>2020-02-28T17:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Embedded Form: Populating form fields</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/402024#M20682</link>
      <description>&lt;P&gt;Hi, how do you handle select boxes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:56:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Embedded-Form-Populating-form-fields/m-p/402024#M20682</guid>
      <dc:creator>prosa</dc:creator>
      <dc:date>2021-01-21T17:56:44Z</dc:date>
    </item>
  </channel>
</rss>

