<?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: Filling a hidden field with a value in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/882320#M10488</link>
    <description>&lt;P&gt;Wondering if I can tag on here!&amp;nbsp; Also looking to do this but also serve up the relevant content asset via redirect upon form submission. Could the same be done here to have a hidden field to set the redirect just as the&amp;nbsp;&lt;SPAN&gt;'submission_identifier' example above?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 20:29:18 GMT</pubDate>
    <dc:creator>js904</dc:creator>
    <dc:date>2023-11-20T20:29:18Z</dc:date>
    <item>
      <title>Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818664#M9647</link>
      <description>&lt;P&gt;Hey all!&lt;BR /&gt;&lt;BR /&gt;So what script I should use to fill in a hidden field in a form with a certain value?&lt;BR /&gt;Backstory: we are using global forms for whitepapers and we need to distinguish betweent the submissons to be able to send the right guide.&lt;BR /&gt;&lt;BR /&gt;This hidden field value will be the differentiator in workflows.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 08:46:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818664#M9647</guid>
      <dc:creator>HenrikR</dc:creator>
      <dc:date>2023-07-12T08:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818724#M9649</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/597671"&gt;@HenrikR&lt;/a&gt;&amp;nbsp;there's no default script to use.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only supported way to fill hidden fields with a value is via &lt;A href="https://knowledge.hubspot.com/forms/can-i-auto-populate-form-fields-through-a-query-string" target="_blank" rel="noopener"&gt;query strings&lt;/A&gt;. If you just want a static value on a form, then you can easily do this via the forms editor by just setting a default value for the field within the forms editor.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a dynamic value however, there are ways you could capture and set a value via &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="noopener"&gt;customising the form&lt;/A&gt; embed code too. What code that is though would really depend on what values you're trying to set. You'll need a script which determines and sets a value and then passes it to the hidden field.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's an article here which is about setting a dynamic redirect for a form, but does have code taking a value from another field. Some of this might help, but you'll need some JS skills to update it for your needs to write the end code!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Embedded-Form-submission-amp-redirect-URL-based-on-form/m-p/287190" target="_blank"&gt;https://community.hubspot.com/t5/APIs-Integrations/Embedded-Form-submission-amp-redirect-URL-based-on-form/m-p/287190&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 10:48:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818724#M9649</guid>
      <dc:creator>TomM2</dc:creator>
      <dc:date>2023-07-12T10:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818729#M9651</link>
      <description>&lt;P&gt;Heyy&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/141"&gt;@TomM2&lt;/a&gt;&amp;nbsp;! And thanks for the reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll open this up a bit more:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;We would use one global form for all whitepapers&lt;/LI&gt;&lt;LI&gt;The global form would have hidden field in it&lt;/LI&gt;&lt;LI&gt;The page where the form would be embedded would have a script that would fill in the hidden field with a certain value, which remains the same at all times for that page&lt;BR /&gt;&lt;BR /&gt;so the script would have the field ID and a value that it fill into the field when the form is submitted. f.ex. we have a Trends ebook -page that has the "Global Whitepaper" form embedded there. The Trends ebook -page would have a script that would fill in the value 'trends23' into a field 'submission_identifier'. In Hubspot we have a workflow that is triggered with "Global Whitepaper" -form and 'submission_identifier' equals 'trends23'. Then the workflow would send the right whitepaper&amp;nbsp; email. So the value 'trends23' is not dynamic, it is always same for that page. Page query strings are a bit messy, if you have multiple landing pages for the same ebook. Then it is just easier to use the 'trends23' identifyer.&lt;BR /&gt;&lt;BR /&gt;Hopefully this makes sense!&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 12 Jul 2023 11:03:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818729#M9651</guid>
      <dc:creator>HenrikR</dc:creator>
      <dc:date>2023-07-12T11:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818734#M9652</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/597671"&gt;@HenrikR&lt;/a&gt;&amp;nbsp;that makes sense. Customising the form embed code is your best solution then. You'll need some JS experience to write this and troubleshoot any issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found a few guides which might be able to help with this though!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/CMS-Development/Setting-form-field-values-with-javascript/td-p/762173" target="_blank"&gt;https://community.hubspot.com/t5/CMS-Development/Setting-form-field-values-with-javascript/td-p/762173&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Passing-values-from-js-form-to-hubspot-form/m-p/319943" target="_blank"&gt;https://community.hubspot.com/t5/APIs-Integrations/Passing-values-from-js-form-to-hubspot-form/m-p/319943&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/CRM/Set-value-of-hidden-form-field-using-Javascript/m-p/485262" target="_blank"&gt;https://community.hubspot.com/t5/CRM/Set-value-of-hidden-form-field-using-Javascript/m-p/485262&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A very basic version would just be adding a line to your forms embed code like this:&lt;/P&gt;
&lt;PRE&gt;hbspt.forms.create({
        css: '',
	portalId: "{{portalId}}",
	formId: "{{formId}}",
	onFormReady: function($form) {
            $('input[name="My_Custom_field"]').val("trends23").change();
     }&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jul 2023 11:13:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818734#M9652</guid>
      <dc:creator>TomM2</dc:creator>
      <dc:date>2023-07-12T11:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818760#M9655</link>
      <description>&lt;P&gt;Super&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/141"&gt;@TomM2&lt;/a&gt;&amp;nbsp;! thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 12:11:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818760#M9655</guid>
      <dc:creator>HenrikR</dc:creator>
      <dc:date>2023-07-12T12:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818766#M9657</link>
      <description>&lt;P&gt;Happy to help!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 12:17:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/818766#M9657</guid>
      <dc:creator>TomM2</dc:creator>
      <dc:date>2023-07-12T12:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/882320#M10488</link>
      <description>&lt;P&gt;Wondering if I can tag on here!&amp;nbsp; Also looking to do this but also serve up the relevant content asset via redirect upon form submission. Could the same be done here to have a hidden field to set the redirect just as the&amp;nbsp;&lt;SPAN&gt;'submission_identifier' example above?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 20:29:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/882320#M10488</guid>
      <dc:creator>js904</dc:creator>
      <dc:date>2023-11-20T20:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Filling a hidden field with a value</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/882586#M10495</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/665647"&gt;@js904&lt;/a&gt;&amp;nbsp; you would want something like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Redirecting-Hubspot-form-to-different-urls-depending-on-property/td-p/692081" target="_blank"&gt;https://community.hubspot.com/t5/APIs-Integrations/Redirecting-Hubspot-form-to-different-urls-depending-on-property/td-p/692081&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 10:33:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Filling-a-hidden-field-with-a-value/m-p/882586#M10495</guid>
      <dc:creator>TomM2</dc:creator>
      <dc:date>2023-11-21T10:33:31Z</dc:date>
    </item>
  </channel>
</rss>

