# Confirm on button click

**URL:** <https://forum.inductiveautomation.com/t/confirm-on-button-click/103405>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 7, 2025, 10:04pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405 "2025-03-07T22:04:13Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaaa](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aaaa](https://forum.inductiveautomation.com/u/aaaa)\
**Post date:** [March 7, 2025, 10:04pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/1 "2025-03-07T22:04:13Z")

</div>

Hello, I'm wondering if it's possible to have a "confirm click" pop-up with the button component in vision? I see it for the 2-state toggle but not the button.. Thanks!

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:11pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/2 "2025-03-07T22:11:29Z")

</div>

I believe you'll need to use the one-shot button for confirmation. If that doesn't work for you, you'll have to script your own.

---

<div class="post-metadata">

**Author:** ![aaaa](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aaaa](https://forum.inductiveautomation.com/u/aaaa)\
**Post date:** [March 7, 2025, 10:13pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/3 "2025-03-07T22:13:08Z")

</div>

By confirmation I mean a pop up window to the user in the HMI that says "are you sure?" or similar after they click the button. Which is different from the one-shot button.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:16pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/4 "2025-03-07T22:16:02Z")

</div>

Yes, the one-shot has that capability, but the one-shot will write a single value (like 1) to the value when clicked and optionally confirmed via an "are you sure?" message.

How do you expect a momentary button to work? Momentary meaning a 1 is written when pressed, then a 0 when released. What happens when the dialog box pops up? The user must release their mouse button to click the confirm button. So that's probably why there's no option for this.

---

<div class="post-metadata">

**Author:** ![aaaa](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aaaa](https://forum.inductiveautomation.com/u/aaaa)\
**Post date:** [March 7, 2025, 10:18pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/5 "2025-03-07T22:18:53Z")

</div>

Hmmm. I thought one shot waits for the PLC to reset the variable, no? I don't want to do that

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 7, 2025, 10:19pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/6 "2025-03-07T22:19:05Z")

</div>

> [@Security Confirmation popup problem](https://forum.inductiveautomation.com/t/security-confirmation-popup-problem/24113/2):
>
> No, you cannot make a popup work in this case. Use a toggle button in addition to your momentary button, with the toggle controlling the enabled property of the momentary button. That will give you two-step functionality without needing a popup. Use a release script on your momentary button to reset the toggle if you wish the user to confirm every time.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:22pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/7 "2025-03-07T22:22:32Z")

</div>

Yes, but how do you expect a momentary button to work? Are you wanting the HMI to send a 1, wait a bit, then write a 0 after confirming?

If you use a 1-shot button with the PLC resetting the 1 back to a 0, it will be more reliable than a momentary button. If you don't have control of the PLC code to make this possible, then you'll have to script your own where you can use the 1-shot button, but script it so that after a delay it writes a 0 back (don't use a timer). Use `system.util.invokeLater` with a function and a delay on the actionPerformed event handler.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 7, 2025, 10:23pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/8 "2025-03-07T22:23:10Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e9ead3d82851c9992129760a19e13d5392a34676.png)

Do this, change to the script editor and check the value of your tag before requiring confirmation and writing the value.

```python
#read custom property bidirectionally bound to tag
currentTagValue = event.source.tag

#button is on, turn it off
if currentValue:
	event.source.tag = 0

#button is off, confirm and then turn on
else:
	if system.gui.confirm(u'Are you sure?', 'Confirm'):
		event.source.tag = 1

```

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:27pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/9 "2025-03-07T22:27:07Z")

</div>

This is still working like a 1-shot though. It only writes a single value. They're wanting a 1, wait, then 0 like a momentary.

What @ryan.white linked would work too, but isn't a dialog confirmation, but more of an "arm the momentary button" toggle that enables the momentary button.

---

<div class="post-metadata">

**Author:** ![aaaa](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aaaa](https://forum.inductiveautomation.com/u/aaaa)\
**Post date:** [March 7, 2025, 10:27pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/10 "2025-03-07T22:27:22Z")

</div>

It doesn't need to be a momentary button. I want a variable to be set to true but only after the user confirms they want that to happen and it wasn't clicked by accident. I feel like there has to be a simpler way of doing this with the "button" component.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 7, 2025, 10:28pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/11 "2025-03-07T22:28:08Z")

</div>

Not sure where the momentary requirement came from

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:28pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/12 "2025-03-07T22:28:17Z")

</div>

If it's only being set to true and not back to false, then the 1-shot button or the simple require confirmation that @amarks posted will work.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:29pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/13 "2025-03-07T22:29:21Z")

</div>

Oh, I think I mis-read the orignal post.....asking about a button and I interpreted it as momenary button.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 7, 2025, 10:29pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/14 "2025-03-07T22:29:36Z")

</div>

Really, a one-shot button is no different than the standard button component. I'm honestly not sure why both exist...

I guess with the one-shot button you get to skip the scripting dialog box

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:30pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/15 "2025-03-07T22:30:44Z")

</div>

I believe the one-shot button waits for the PLC to reset it back to 0 before enabling it again. And also can change the text while the tag is written to another message.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 7, 2025, 10:31pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/16 "2025-03-07T22:31:07Z")

</div>

The standard button does not set it back to 0 either. I do see the difference now. I haven't used a one-shot button before.

You could easily make the one-shot button component from a standard button component, 2 custom properties, and a style customizer. I see now

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 7, 2025, 10:32pm UTC](https://forum.inductiveautomation.com/t/confirm-on-button-click/103405/17 "2025-03-07T22:32:05Z")

</div>

No, but the button becomes disabled and displays a different message until it gets reset by the PLC.
