# How to hide a section on a dynamic item page when a specific CMS field is blank

**URL:** <https://forum.wixstudio.com/t/how-to-hide-a-section-on-a-dynamic-item-page-when-a-specific-cms-field-is-blank/60241>\
**Category:** Ask the community\
**Tags:** wix-studio, cms, code\
**Created:** [June 24, 2024, 12:57pm UTC](https://forum.wixstudio.com/t/how-to-hide-a-section-on-a-dynamic-item-page-when-a-specific-cms-field-is-blank/60241 "2024-06-24T12:57:03Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![stevemondaymedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stevemondaymedia/32/80631_2.png) [@stevemondaymedia](https://forum.wixstudio.com/u/stevemondaymedia)\
**Post date:** [June 25, 2024, 4:40am UTC](https://forum.wixstudio.com/t/how-to-hide-a-section-on-a-dynamic-item-page-when-a-specific-cms-field-is-blank/60241/13 "2024-06-25T04:40:11Z")

</div>

I use the below example all the time.  
Note the exclamation mark before currentItem, this means ‘if empty’.

Replace:  
#yourDatasetID with the ID of your dynamic page dataset  
databaseFeildID with the field ID in the CMS you want to check  
#itemToHideID with ID of the page item you wish to hide

```javascript
const currentItem = $w('#yourDatasetID').getCurrentItem();

$w.onReady(function () {
     if (!currentItem.databaseFeildID) { $w("#itemToHideID").collapse(); }
});

```

---

_[View the full topic](https://forum.wixstudio.com/t/how-to-hide-a-section-on-a-dynamic-item-page-when-a-specific-cms-field-is-blank/60241)._
