# input field validation

**URL:** <https://community.hubspot.com/t/input-field-validation/17335>\
**Category:** CMS Development\
**Created:** [November 21, 2019, 12:24pm UTC](https://community.hubspot.com/t/input-field-validation/17335 "2019-11-21T12:24:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kamil\_KK](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kamil_kk/32/11153_2.png) [@Kamil\_KK](https://community.hubspot.com/u/Kamil_KK)\
**Post date:** [November 21, 2019, 12:24pm UTC](https://community.hubspot.com/t/input-field-validation/17335/1 "2019-11-21T12:24:10Z")

</div>

Hello All.

I am not really familiar with HubL, I would like to validate input field for presence of text in the banner headder, if there is a text apply styling (transparent background) , if there is no render just a banner. Something like that in JaveScript:

```auto
 const banner = document.getElementById("banner-text");

banner.children[0].textContent.length === 0 ?
banner.style.background = "none" : false;

```

The ide is: thre is a e-mail template and user is able to apply Default text, so I wish to have the sytle depend on presence of thxt or lack of it.  
I would appreciat help.

Best regards.

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 21, 2019, 5:09pm UTC](https://community.hubspot.com/t/input-field-validation/17335/2 "2019-11-21T17:09:38Z")

</div>

You’d probably want to use something like this:

```auto
{% if widget_data.product_names.value %}
<div class="coupon-ad">
<h3>For a limited time, get 50% off {{ widget_data.product_names.value}}! </h3>
</div>
{% else %}

{% endif %}

```

Further information is available here: [If statements - HubSpot docs](https://designers.hubspot.com/docs/hubl/if-statements)

---

<div class="post-metadata">

**Author:** ![Kamil\_KK](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kamil_kk/32/11153_2.png) [@Kamil\_KK](https://community.hubspot.com/u/Kamil_KK)\
**Post date:** [November 22, 2019, 6:45am UTC](https://community.hubspot.com/t/input-field-validation/17335/3 "2019-11-22T06:45:29Z")

</div>

Hello @Anonymous

Thak you I guess this will do!

Cheers.
