# Adding a new CTA on a custom module

**URL:** <https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425>\
**Category:** Lead Capture Tools\
**Tags:** ctas\
**Created:** [February 17, 2023, 3:28am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425 "2023-02-17T03:28:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSahabandu](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@SSahabandu](https://community.hubspot.com/u/SSahabandu)\
**Post date:** [February 17, 2023, 3:28am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/1 "2023-02-17T03:28:16Z")

</div>

Hi, I have managed to edit the custom code to add a new CTA to a dynamic page on our website.

However,

1. I can’t get the new CTA linked to the form.

2. I now have all CTAs stuck together with no buffer space.

Can someone help me identify the mistake I have made with the edited code.

The website page in concern is

[https://www.floorworld.com.au/product-detail/signature-purity-timber?product\_name=Purity%20-%20Timber&brand=Signature&product\_category=vinyl&website\_lead\_form\_filled=REQUEST%20SAMPLES](https://www.floorworld.com.au/product-detail/signature-purity-timber?product_name=Purity%20-%20Timber&brand=Signature&product_category=vinyl&website_lead_form_filled=REQUEST%20SAMPLES)

The 03 CTA’s now look like below;

 ![SSahabandu_0-1676603667293.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/8/e89c295130d5de3da482ce7757e07e725931c2da.png)

The new CTA added was ‘Request Samples’, which does not link to the form created.

I am not sure if I have used the right coding to replicate this CTA. I am not even sure why custom modules were developed for this in the first place.

Please let me know how I can get my CTA linked to the form created and get this page to work as intended please.

Thank you.

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [February 17, 2023, 5:17am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/2 "2023-02-17T05:17:12Z")

</div>

Can you show us the code for that CTA section? It’s not really possible to tell why the link isn’t being filled in by just looking at the site. (If the page is dynamic that’s exactly the reason custom modules were built; HubSpot CTAs do not have dynamic capabilities not to mention they load incredibly slow)  
As for the spacing you would need to add some CSS:

```lia-code-sample
.cta-wrap a + a {
 margin-left: 5px;
}

```

---

<div class="post-metadata">

**Author:** ![SSahabandu](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@SSahabandu](https://community.hubspot.com/u/SSahabandu)\
**Post date:** [February 17, 2023, 5:24am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/3 "2023-02-17T05:24:50Z")

</div>

Hi, Thanks so much for your reply. I will try the spacing now.

the code for the 03 CTAs you see in the pic is below. The text in Red is the code related to the CTA that is not connected correctly to the form.

\</div\>  
\<div class=“cta-wrap”\>  
{% set final\_category = [] %}  
{% for product\_category in dynamic\_page\_hubdb\_row.product\_category %}  
{% do final\_category.append(product\_category.name|lower) %}  
{% endfor %}  
\<!-- \<a href=“/get-a-quote?product\_name={#{ dynamic\_page\_hubdb\_row.name }}&brand={{ final\_category|join(‘,’) }#}”\>GET A QUOTE\</a\> --\>  
\<a href=“/get-a-quote?product\_name={{ dynamic\_page\_hubdb\_row.name }}&brand={{ dynamic\_page\_hubdb\_row.brand[0].name }}&product\_category={{ final\_category|join(‘,’) }}&website\_lead\_form\_filled=Get A Quote”\>GET A QUOTE\</a\>

\<!-- \<a href=“/request-samples?product\_name={#{ dynamic\_page\_hubdb\_row.name }}&brand={{ final\_category|join(‘,’) }#}”\>REQUEST SAMPLES\</a\> --\>

\<a href=“{{dynamic\_page\_hubdb\_row.request\_samples\_link}}?product\_name={{ dynamic\_page\_hubdb\_row.name }}&brand={{ dynamic\_page\_hubdb\_row.brand[0].name }}&product\_category={{ final\_category|join(‘,’) }}&website\_lead\_form\_filled=REQUEST SAMPLES”\>REQUEST SAMPLES\</a\>

{% endif %}

{% if dynamic\_page\_hubdb\_row.room\_button\_label %}\<a href=“javascript:void(0)” id=“trigger-modal” class=“see\_room”\>{{ dynamic\_page\_hubdb\_row.room\_button\_label}}\</a\>{% endif %}  
\</div\>  
\</div\>  
\</div\>

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [February 17, 2023, 5:33am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/4 "2023-02-17T05:33:15Z")

</div>

Seeing as the **{{**  **dynamic\_page\_hubdb\_row.request\_samples\_link }}** variable seems to be the only part not being populated in the link my first thought is : did you add a request\_samples\_link column to the HubDB table the page is pulling data from and add a link path to the column for each row?  
Also, the Get a Quote CTA isn’t using a table variable for its path so is a variable really necessary for the Request Samples CTA path?

---

<div class="post-metadata">

**Author:** ![SSahabandu](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@SSahabandu](https://community.hubspot.com/u/SSahabandu)\
**Post date:** [February 17, 2023, 5:46am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/5 "2023-02-17T05:46:52Z")

</div>

Yes, I did add the link before, but it was not working.

I changed the code as follows;

\<!-- \<a href=“/get-a-quote?product\_name={#{ dynamic\_page\_hubdb\_row.name }}&brand={{ final\_category|join(‘,’) }#}”\>GET A QUOTE\</a\> --\>  
\<a href=“/get-a-quote?product\_name={{ dynamic\_page\_hubdb\_row.name }}&brand={{ dynamic\_page\_hubdb\_row.brand[0].name }}&product\_category={{ final\_category|join(‘,’) }}&website\_lead\_form\_filled=Get A Quote”\>GET A QUOTE\</a\>  
\<!-- \<a href=“/request-samples?product\_name={#{ dynamic\_page\_hubdb\_row.name }}&brand={{ final\_category|join(‘,’) }#}”\>REQUEST SAMPLES\</a\> --\>  
\<a href=“/request-samples?product\_name={{ dynamic\_page\_hubdb\_row.name }}&brand={{ dynamic\_page\_hubdb\_row.brand[0].name }}&product\_category={{ final\_category|join(‘,’) }}&website\_lead\_form\_filled=REQUEST SAMPLES”\>REQUEST SAMPLES\</a\>  
{% endif %}  
{% if dynamic\_page\_hubdb\_row.room\_button\_label %}\<a href=“javascript:void(0)” id=“trigger-modal” class=“see\_room”\>{{ dynamic\_page\_hubdb\_row.room\_button\_label}}\</a\>{% endif %}  
\</div\>  
\</div\>  
\</div\>

and now it goes to a 404 error page.

Could it be that my form is not done correctly?

Also the CTA’s now look like this. I did want them on a horizontal like but this is good too.

Thank you!

---

<div class="post-metadata">

**Author:** ![SSahabandu](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@SSahabandu](https://community.hubspot.com/u/SSahabandu)\
**Post date:** [February 17, 2023, 5:59am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/6 "2023-02-17T05:59:15Z")

</div>

Also, if we can do without the variables being pulled form the HubDb file for the ‘Request samples’ form, how should I go about with the code to link the CTA to the form created?

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [February 17, 2023, 2:01pm UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/7 "2023-02-17T14:01:31Z")

</div>

The link is working now, but it looks like [https://www.floorworld.com.au/request-samples](https://www.floorworld.com.au/request-samples)doesn’t exist. You would need to create and publish a /request-samples page. If it’s going to be just a form like the [Quote Enquiry | Floorworld](https://www.floorworld.com.au/get-a-quote) page you could just clone that page and switch in the form you want.

---

<div class="post-metadata">

**Author:** ![SSahabandu](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@SSahabandu](https://community.hubspot.com/u/SSahabandu)\
**Post date:** [February 21, 2023, 1:27am UTC](https://community.hubspot.com/t/adding-a-new-cta-on-a-custom-module/75425/8 "2023-02-21T01:27:17Z")

</div>

thank you for your help!
