Thanx for the help Julien.
Before testing the script, I simply added a new email field to the table: ‘validEmail’ and manually entered the user email address that I expect to grant permission to access the form.
I have the need to hide two form blocks: form-es and form-en
Then I went to page custom code ==> footer and added this code:
<script>
//Hide form if 'validEmail' is different from logged-in user email
document.addEventListener("DOMContentLoaded", function() {
var waitForData = setInterval(function () {
if (typeof $ != 'undefined') {
if (document.querySelectorAll('div[data-mappedto="validEmail"][data-value*={LOGGED_IN_USER:EMAIL} i]').length > 0) {
var form1 = document.getElementById('form-es');
var form2 = document.getElementById('form-en');
form1.style.display = 'none';
form2.style.display = 'none';
clearInterval(waitForData);
}
}
}, 100);
});
</script>
Then no matter the case, every logged-in user to my app can access the form.