Viewon button disable

I need a method to “disable” or “cover” a viewon push button based on the status of a bool tag in the PLC. It seems the push buttons always rise to the top of all the layers?

Hello,

You can explore some options with Javascript. We do not have any specific examples of this, unfortunately.

An alternate route is to develop some BASIC script for the button to “disable” the button based on the Bool Tag. That if the user presses the button while the Tag is not active, it doesn’t perform the action. The button will still display, but it would not do anything unless the tag is active.

Do you have any addiitonal questions regarding the ViewON button?

I have tried several variations of the code below with no success. It looks like it should work, do you know what I am doing wrong?

var ID = “UID_1616462860613”;
var x = document.getElementById(ID);
var y = getEwonTagVal(‘Viewon_Bool[0]’);

if (y == 0) {
x.style.disabled = true;

} else {
x.style.removeAttribute(‘disabled’);
}

This works but I would rather not totally hide the button. I would like to grey it out or disable. Not sure why the “disable” option in the last post is not working?

var y = getEwonTagVal(‘Viewon_SupvrEditActive’);

var ID1 = “UID_1616462860613”;
var x1 = document.getElementById(ID1);

if (y == 0) {
x1.style.display = ‘None’;
} else {
x1.style.display = ‘initial’;
}

Hello,

Let me run some tests on my end and see if i can find anything