<?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: How to make redirection urls dynamic in hubspot module. in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/769638#M33356</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/367528"&gt;@FurqanAli&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I was working on setting the form redirection after submission based on the select box values in my form and I was able to set it up in javascript but how I can make it dynamic by adding the possibility to a set URL for different options from my module in the editor using hubl.&lt;BR /&gt;&lt;BR /&gt;my javascript code:&lt;BR /&gt;let result;&lt;BR /&gt;// console.log("Checking result: "+result);&lt;BR /&gt;window.addEventListener('message', event =&amp;gt; {&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmit') {&lt;BR /&gt;result = event.data.data.find(x =&amp;gt; x.name === 'workspace_size').value;&lt;BR /&gt;}&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmitted') {&lt;BR /&gt;if (result === '1-45') {&lt;BR /&gt;window.location = '&lt;A href="https://accedii.com/" target="_blank" rel="noopener"&gt;https://www.accedii.com&lt;/A&gt;';&lt;BR /&gt;} else if (result === '46-200'){&lt;BR /&gt;window.location = '&lt;A href="https://www.example2.com" target="_blank" rel="noopener"&gt;https://www.example2.com&lt;/A&gt;';&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks For It! I'm also suffering from this issue and it really helpful.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 12:17:30 GMT</pubDate>
    <dc:creator>DHarrison0</dc:creator>
    <dc:date>2023-03-16T12:17:30Z</dc:date>
    <item>
      <title>How to make redirection urls dynamic in hubspot module.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768431#M33293</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I was working on setting the form redirection after submission based on the select box values in my form and I was able to set it up in javascript but how I can make it dynamic by adding the possibility to a set URL for different options from my module in the editor using hubl.&lt;BR /&gt;&lt;BR /&gt;my javascript code:&lt;BR /&gt;let result;&lt;BR /&gt;// console.log("Checking result: "+result);&lt;BR /&gt;window.addEventListener('message', event =&amp;gt; {&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmit') {&lt;BR /&gt;result = event.data.data.find(x =&amp;gt; x.name === 'workspace_size').value;&lt;BR /&gt;}&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmitted') {&lt;BR /&gt;if (result === '1-45') {&lt;BR /&gt;window.location = '&lt;A href="https://www.example1.com" target="_blank"&gt;https://www.example1.com&lt;/A&gt;';&lt;BR /&gt;} else if (result === '46-200'){&lt;BR /&gt;window.location = '&lt;A href="https://www.example2.com" target="_blank"&gt;https://www.example2.com&lt;/A&gt;';&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 13:38:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768431#M33293</guid>
      <dc:creator>FurqanAli</dc:creator>
      <dc:date>2023-03-14T13:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to make redirection urls dynamic in hubspot module.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768814#M33311</link>
      <description>&lt;P&gt;Add some URL fields to your module and put your js inside a {% require_js %} tag in the modules HTML + HubL area like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% require_js %}
&amp;lt;script&amp;gt;
 let result;
window.addEventListener('message', event =&amp;gt; {
if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmit') {
result = event.data.data.find(x =&amp;gt; x.name === 'workspace_size'').value;
}
if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmitted') {
if (result === '1-45') {
window.location = '{{ module.url_1.href }}';
} else if (result === '46-200'){
window.location = '{{ module.url_2.href }}';
}
}
}); 
&amp;lt;/script&amp;gt;
{% end_require_js %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{{ module.url_1.href }} and&amp;nbsp;{{ module.url_2.href }} being the call to the module fields.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tested it in my portal and it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="profile2022a" style="width: 100px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/71500iE96AB1F9E9E277B9/image-size/small?v=v2&amp;amp;px=200" role="button" title="profile2022a" alt="profile2022a" /&gt;&lt;/span&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Barry Grennan&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.seoanseo.ca?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Website&lt;/A&gt; | &lt;A href="https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity" target="_blank" rel="nofollow noopener noreferrer"&gt;Contact&lt;/A&gt; | &lt;A href="https://www.linkedin.com/in/barrygrennan" target="_blank" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 03:36:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768814#M33311</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2023-03-15T03:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to make redirection urls dynamic in hubspot module.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768978#M33321</link>
      <description>&lt;P&gt;Thanks a lot,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/146956"&gt;@BarryGrennan&lt;/a&gt;&amp;nbsp;I had a similar solution in my mind.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 11:51:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/768978#M33321</guid>
      <dc:creator>FurqanAli</dc:creator>
      <dc:date>2023-03-15T11:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to make redirection urls dynamic in hubspot module.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/769638#M33356</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/367528"&gt;@FurqanAli&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I was working on setting the form redirection after submission based on the select box values in my form and I was able to set it up in javascript but how I can make it dynamic by adding the possibility to a set URL for different options from my module in the editor using hubl.&lt;BR /&gt;&lt;BR /&gt;my javascript code:&lt;BR /&gt;let result;&lt;BR /&gt;// console.log("Checking result: "+result);&lt;BR /&gt;window.addEventListener('message', event =&amp;gt; {&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmit') {&lt;BR /&gt;result = event.data.data.find(x =&amp;gt; x.name === 'workspace_size').value;&lt;BR /&gt;}&lt;BR /&gt;if(event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormSubmitted') {&lt;BR /&gt;if (result === '1-45') {&lt;BR /&gt;window.location = '&lt;A href="https://accedii.com/" target="_blank" rel="noopener"&gt;https://www.accedii.com&lt;/A&gt;';&lt;BR /&gt;} else if (result === '46-200'){&lt;BR /&gt;window.location = '&lt;A href="https://www.example2.com" target="_blank" rel="noopener"&gt;https://www.example2.com&lt;/A&gt;';&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks For It! I'm also suffering from this issue and it really helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 12:17:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-make-redirection-urls-dynamic-in-hubspot-module/m-p/769638#M33356</guid>
      <dc:creator>DHarrison0</dc:creator>
      <dc:date>2023-03-16T12:17:30Z</dc:date>
    </item>
  </channel>
</rss>

