How to hide an information tile on ui builder based on a dynamic #formLookup value in Joget?
Confluence User - 18 Aug, 2025
Hello everyone,
I'm trying to conditionally hide an information tile component in a Joget app based on a user's medical status, which is loaded dynamically. The goal is to hide the entire tile if the status is "Not Eligible".
My script works, but only after I refresh the page. On the initial page load, the tile still shows up.
Heres's the tile's code:
<!--{sampleWidth: '250px', tags: 'light-bg icon'}-->
<div class="card flex-row align-items-center
align-items-stretch pr-2 pl-4 medical-info-tile"
style="height:{{height}};
background-color:{{bgColor}};
background-image:url('{{bgImg}}');">
<div style="position: absolute;
top: 5px;
right: 5px;
z-index: 1;">
{{reload}}
</div>
<div class="stats-icon col-4 p-0 d-flex align-items-center
justify-content-center rounded-left">
<span style="font-size: 32px;
height: 66px;
width: 66px;
line-height: 58px;
border:4px solid #ffffffcf;
text-align:center;
border-radius:50%;
background-color:{{color||#563d7c}};
color:#fff">
{{icon||<i class="fas fa-globe"></i>}}
</span>
</div>
<div class="stats-info py-3 pr-3 pl-2 col-8">
<div class="d-flex flex-row align-items-center"
style="font-size: 24px;
margin-bottom: 10px;">
<span class="status-value" style="display: none;">#formLookup.master_employee.status_medical[name={currentUser.fullName}]#</span>
<span>Rp </span>
<span id="inapBalance">
#formLookup.master_pfd_in.balance[employee_name={currentUser.fullName},year={date.yyyy}]#
</span>
</div>
<h4 style="font-size: 12px;
color: rgba(0,0,0,.6);
margin: 5px 0;">
{{title||TOTAL VISITORS}}
</h4>
</div>
</div>
<!---->
<script>
document.addEventListener('DOMContentLoaded', function() {
const el = document.getElementById("inapBalance");
const num = parseFloat(el.innerText);
if (!isNaN(num)) {
el.innerText = num.toLocaleString("id-ID");
}
const statusElement = document.querySelector('.medical-info-tile .status-value');
if (statusElement) {
const medicalStatus = statusElement.textContent.trim();
if (medicalStatus === 'Not Eligible') {
const tileToHide = statusElement.closest('.medical-info-tile');
if (tileToHide) {
tileToHide.style.display = 'none';
};
};
};
});
</script>
dashboard;customhtml;javascript;hashvariable