# Ignition Perspective 8.1.48-One shot button is disable still executes the scripts

**URL:** <https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [September 16, 2026, 10:38am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100 "2026-09-16T10:38:15Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 16, 2026, 10:38am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/1 "2026-09-16T10:38:15Z")

</div>

I am using a **One Shot Button** to perform a calculation. There are several input fields, and I want the **Calculate** button to be enabled or disabled based on the user's input activity.

For example, if a user is entering a value in an input field, the **Calculate** button should remain disabled until the field loses focus (on blur).

Currently, my logic correctly disables the button while the user is editing a field. However, when I click the **Calculate** button, the calculation still executes, and the button becomes enabled. This appears to be a race condition between the field's blur event and the button's action execution.

Do you have any suggestions on how to achieve this?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 16, 2026, 11:03am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/2 "2026-09-16T11:03:51Z")

</div>

Tip: edit your question title and add the Ignition version and module (Vision or Perspective) tags. It looks like you're asking about Vision.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 16, 2026, 11:40am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/3 "2026-09-16T11:40:17Z")

</div>

It is Ignition perspective version 8.1.48.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 16, 2026, 11:43am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/4 "2026-09-16T11:43:20Z")

</div>

The tags are in a dropdown below the title. I've added them in. It helps you get attention from folks who watch particular tags.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 16, 2026, 11:47am UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/5 "2026-09-16T11:47:25Z")

</div>

Make sure that you are using **onActionPerformed** event and not the **onClick** event.

- **onActionPerformed** will respect the button's Enabled property.
- **onClick** doesn't. The event will fire even if `Enabled: false`.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 16, 2026, 12:06pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/6 "2026-09-16T12:06:45Z")

</div>

The code was initially implemented in the `onActionPerformed` event, but it wasn't working as expected. I have now moved the logic to the `onClick` event. but No luck.

Calculate code is in custom method and I am calling that custom method On "On Click" or `onActionPerformed` event

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 16, 2026, 12:13pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/7 "2026-09-16T12:13:12Z")

</div>

As @Transistor says, the "On Click" event **does not check the enabled prop**. Only the actionPerformed event will meet your requirement.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 16, 2026, 12:17pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/8 "2026-09-16T12:17:54Z")

</div>

okay, let me try again.  
Thanks!!

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 17, 2026, 12:50pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/9 "2026-09-17T12:50:47Z")

</div>

I'm experiencing something unusual.  
When the browser's Inspect Element window is open, the `actionPerformed` event does not trigger if the button is disabled.  
However, when the Inspect Element window is closed, the event still gets triggered even though the button disabled.

Do you have any idea what might be causing this behavior?

---

<div class="post-metadata">

**Author:** ![Samuel\_Sueur](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Samuel\_Sueur](https://forum.inductiveautomation.com/u/Samuel_Sueur)\
**Post date:** [September 17, 2026, 12:56pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/10 "2026-09-17T12:56:16Z")

</div>

You might have to provide us with some actual screenshots or snippets of code to really pinpoint what's going on here...

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 17, 2026, 1:12pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/11 "2026-09-17T13:12:00Z")

</div>

editing is the custom property on root, On input fields on focus event it is set to True and On blur it is set to False.

this is the binding on one shot Button enable property

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/870e62cb43810957520491918fb1eaa0e8ac7c71.png)

and below is the action performed code, just call to custom method

self.view.getChild("root").Calculate()

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 17, 2026, 1:20pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/12 "2026-09-17T13:20:43Z")

</div>

> [@Anita.Shinde](#):
>
> have any idea

No, sorry. You may need to open a support ticket to see what is messing with your environment.

---

<div class="post-metadata">

**Author:** ![Samuel\_Sueur](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Samuel\_Sueur](https://forum.inductiveautomation.com/u/Samuel_Sueur)\
**Post date:** [September 17, 2026, 1:22pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/13 "2026-09-17T13:22:18Z")

</div>

Right, so indeed I reproduce the same behavior.

What I think is happening is :

- When you click down on the Calculate button, the `onBlur` event is triggered
- By the time you release the click, the custom `editing` is already back to `False` and it triggers the `onActionPerformed` event.

A workaround, **although not ideal** :

Use the `onMouseDown` event instead of `onActionPerformed`.  
Make sure to check if the custom `editing` is in the correct state so that it does not trigger if it is not in the correct state :

```python
	if not self.view.custom.editing:
		system.perspective.print('execution')

```

It works on my end but not sure it will work on yours.

If this is not good enough for you, yeah you might need to see that with the support.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 17, 2026, 1:27pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/14 "2026-09-17T13:27:34Z")

</div>

> [@Samuel\_Sueur](#):
>
> think is happening

Makes sense.

The order of events is likely to race, and I would expect onBlur on a field to fire before any event on a separate button. onBlur is simply the wrong event to guard this button. Consider only using onFocus, and setting a view custom property to the name of the most recently focused input field. Then the calculate enable prop can be driven by an expression comparing that custom prop to the appropriate name. No race.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [September 17, 2026, 2:23pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/15 "2026-09-17T14:23:04Z")

</div>

I've just moved the set value into a self.custom.value that the one shot sets and then an on change script on that value executes what you want it to do and then sets itself back to false when done.

Sorta unrelated: I wish the basic button had options for click confirmation, without that we use one shots for almost everything.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 17, 2026, 2:43pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/16 "2026-09-17T14:43:29Z")

</div>

> [@Nol](#):
>
> had options for click confirmation

Confirmation popups are a UI flaw or "code smell" in my not-so-humble opinion. Anything that needs two-step confirmation should have "mode" for it. A toggle to set the "do something" **mode** , which enables the "do something" button itself. (Or multiple such.) The mode can be made to expire if unused, end on use, or end when the operator toggles it back off. No races. No popups. Actual actions happen exactly when commanded, not after a popup.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [September 17, 2026, 2:49pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-8-1-48-one-shot-button-is-disable-still-executes-the-scripts/117100/17 "2026-09-17T14:49:13Z")

</div>

I see where you're coming from for authenticating a critical action but with using perspective on touch tablets it's just nicer having the are you sure? pop up for basic things as a default function of the button.
