Avoid duplicate confirmation dialogs during tag write operation

I have a vision button that displays an ignition in-built confirmation popup. When the user clicks OK in the popup, the script writes to a tag and updates the button text.

However, if the button is clicked again immediately after clicking OK (before the tag write completes), the popup appears again.

How can I prevent the popup from appearing until the tag write has fully completed?

You could disable the button first thing in the script. Then enable it after the tag write attempt. You might want to check the tag write return value for success and add a try/except so you don’t end up in an undefined state depending on what you script looks like.

we are having multiple components
It is difficult to handle this for individual component is there any way to handle this globally

What do you mean multiple components? You could use a single root-level property (or vision client tag) to enable/disable the components until the write is complete and then bind that to all components that you need temporarily disabled and then re-enable with a gateway event script.

Even that doesn’t sound like a great idea, so I guess the question we should be asking is - is there a better way to handle this than what is currently being used?

Is there a problem that is caused by writing the tag twice?

Would checking the value of the tag or another prop during the script and before writing it help? Update the prop first in the script before writing. That way, even if the confirm popup appears again it doesn’t actually do anything if the tag has already been written.

Do you mean multiple clients? Other users are also simultaneously clicking the button because of the popup?

If not, system.tag.writeBlocking should lock the local gui and prevent any user inputs until the write operation has completed

The issue is that we have a button with a script that writes a tag along with a confirmation message (“Run” or “Stop”). The problem we observed is that when we click the button and select “Run,” it still allows us to click the same button again. Due to multiple clicks and the slow tag update, the message continues to display “Run,” whereas it should change to “Stop” once the value is updated.

We want to disable multiple clicks on this specific button until the “Run” request is fully executed. However, other buttons on the screen should remain clickable and function normally during this time.

As there are many similar buttons throughout the project, we are looking for a simple, global solution that can be applied across all components, rather than having to rework the script in each one individually.

There's no magic wand, sorry. You will have to touch the script in every button. The script should disable the button to prevent re-clicks until confirmation comes back from the PLC.

I would also suggest you not try to display a pre-emptive status--let the actual status from the PLC drive that display.

If you move the common logic to a project library script, you will reduce the amount of correction per button, and will set yourself for easier future maintenance.

Slow response times suggest other problems--you should fix the slow response times.

Templates are what I use for repetitive components, so I can make changes in one place instead of having to touch many instances of the same thing.

This sounds like a binding that doesn't immediately reflect the tag change. If so, you could try adding system.db.refresh to the script to immediately trigger the binding update after the tag write.

1 Like

Bind the run/stop button “state” to the tag that you’re trying to write. That way your “confirm” button is always accurate, even if the popup is opened before the write is completed.