# Hubl Widget\_data returning 0

**URL:** <https://community.hubspot.com/t/hubl-widget-data-returning-0/10465>\
**Category:** CMS Development\
**Created:** [October 4, 2018, 12:41pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465 "2018-10-04T12:41:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisCom](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chriscom/32/78471_2.png) [@ChrisCom](https://community.hubspot.com/u/ChrisCom)\
**Post date:** [October 4, 2018, 12:41pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465/1 "2018-10-04T12:41:58Z")

</div>

Hi all,

I’m wondering if anyone can help please.

I’m trying to get widget data to output within an if statement and for some reason no matter what I try it always returns 0. Other parts of the email template work fine, its just anything within the if. Here’s the code I have below.

{% image ‘cta1-logo’ label=‘(CTA-1) Logo (220x80)’, alt=‘Logo’, src=‘’, export\_to\_template\_context=True %}  
{% text ‘cta1-location1’ label=‘(CTA-1) Location Line 1’, value=‘Location Line’, export\_to\_template\_context=True %}  
{% text ‘cta1-location2’ label=‘(CTA-1) Location Line 2’, value=‘Location Line’, export\_to\_template\_context=True %}  
{% text ‘cta1-date’ label=‘(CTA-1) Date’, value=‘Date’, export\_to\_template\_context=True %}  
{% text ‘cta1-url’ label=‘(CTA-1) URL’, value=‘URL’, export\_to\_template\_context=True %}

{% if widget\_data.ctano.value \> 1 %}  
\<img src=“{{ widget\_data.cta1-logo.src }}” alt=“{{ widget\_data.cta1-location1.value }}” width=“220” height=“80” border=“0”\>

{{ widget\_data.cta1-location1.value }}

{{ widget\_data.cta1-location2.value }}

{{ widget\_data.cta1-date.value }}

\<a href=“{{ widget\_data.cta1-url.value }}” title=“”\>Link\</a\>  
{% endif %}

As I say each of those return 0, I can’t get it to output user input or even the defaults.

Thanks, Chris.

---

<div class="post-metadata">

**Author:** ![Craig](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/craig/32/60219_2.png) [@Craig](https://community.hubspot.com/u/Craig)\
**Post date:** [October 4, 2018, 1:29pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465/2 "2018-10-04T13:29:50Z")

</div>

What is returning zero? Which line?

Where is ctano defined?

If it’s length is what is returning zero, try the length pipe

`{% if widget_data.ctano.value|length > 1 %}`

---

<div class="post-metadata">

**Author:** ![ChrisCom](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chriscom/32/78471_2.png) [@ChrisCom](https://community.hubspot.com/u/ChrisCom)\
**Post date:** [October 4, 2018, 1:54pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465/3 "2018-10-04T13:54:55Z")

</div>

Hi,

Sorry no its not the value \> 1 bit that isn’t working, thats fine, its everything from within the if statement.

So all the text.values are returning 0, even the .src is returning 0.

---

<div class="post-metadata">

**Author:** ![Craig](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/craig/32/60219_2.png) [@Craig](https://community.hubspot.com/u/Craig)\
**Post date:** [October 4, 2018, 2:53pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465/4 "2018-10-04T14:53:37Z")

</div>

Ah! You need to use underscores, [HubL doesn’t accept hyphens in module names](https://designers.hubspot.com/docs/hubl/hubl-module-syntax-and-parameters)

So

`{% text 'cta1-location1' label='(CTA-1) Location Line 1', value='Location Line', export_to_template_context=True %}`

becomes

`{% text 'cta1_location1' label='(CTA-1) Location Line 1', value='Location Line', export_to_template_context=True %}`

And then update your widget\_data lines to reflect this change also.

---

<div class="post-metadata">

**Author:** ![ChrisCom](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chriscom/32/78471_2.png) [@ChrisCom](https://community.hubspot.com/u/ChrisCom)\
**Post date:** [October 4, 2018, 3:20pm UTC](https://community.hubspot.com/t/hubl-widget-data-returning-0/10465/5 "2018-10-04T15:20:52Z")

</div>

Ah, that was it! I thought of that at one point but ruled it out early. Knew I should have tested it!

Great stuff thanks so much for the help!

Hopefully this will help someone else in the future.
