# Security confirmation dialog

**URL:** <https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545>\
**Category:** Ignition\
**Created:** [January 14, 2015, 4:25pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545 "2015-01-14T16:25:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 14, 2015, 4:25pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/1 "2015-01-14T16:25:21Z")

</div>

hi all,

newbie question, how to add security confirmation in button that bind to UDT parameter (boolean)?

so, i have 2 momentary button that handle Open and Close, i use UDT parameter for this button. im bit confuse how to add security confirmation on this button, coz i only find the security confirmation on the scripting properties.

Thanks.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [January 14, 2015, 4:36pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/2 "2015-01-14T16:36:23Z")

</div>

There should be a security tab on the property editor window that you can change security on each component by role. Is this what you’re talking about?

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/376b89083cecb328b55736d6c0b0bed6482ff2be.png)

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 14, 2015, 10:13pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/3 "2015-01-14T22:13:47Z")

</div>

thanks duffanator for your reply,

but this is what i need

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0c8ab973a1498a6f9186a3534b7d771f367d7d90.png)  

so i bind this momentary button to boolean tag in UDT, for open and close.

so, when someone click the button, the confirmation dialog will popup, after they click yes, the the value of the UDT tag will change from 0 to 1.

but i dont know how to do this for the UDT tags.

thanks

---

<div class="post-metadata">

**Author:** ![CPowell](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@CPowell](https://forum.inductiveautomation.com/u/CPowell)\
**Post date:** [January 14, 2015, 11:00pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/4 "2015-01-14T23:00:49Z")

</div>

So something like this?

```auto
tagpath = 'Path to UDT' 
if system.gui.confirm(u'Are you sure?', 'Confirm'):
	value = event.source.close
	system.tag.writeToTag(tagpath + '/CLOSE', value)
```

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 14, 2015, 11:04pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/5 "2015-01-14T23:04:18Z")

</div>

Hi CPowell,

yes thats what i need

[code]if system.gui.confirm(u’Are you sure?’, ‘Confirm’):  
value = event.source.parent.getComponent(‘Temperature Sensor 5’).getComponent(‘Momentary Button’).controlValue

```
event.source.parent.MOV.OPEN = value[/code]

```

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b98a94b3919c4cf4fe1a5d88b3f3225d62fa2720.png)  

so i set the UDT tag value based on the momentary button control value.

but there still a problem,

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a888f325def69c0517eb6f7358a3415c7d48609e.png)  

the value has change even before i click Yes as confirmation to change the value from 0 to 1, so the confirmation dialog is useless.

any idea

thanks

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 15, 2015, 11:00pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/6 "2015-01-15T23:00:07Z")

</div>

Any idea for this problem?

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 20, 2015, 2:16am UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/7 "2015-01-20T02:16:40Z")

</div>

Please any one?

---

<div class="post-metadata">

**Author:** ![Blefe001](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Blefe001](https://forum.inductiveautomation.com/u/Blefe001)\
**Post date:** [January 20, 2015, 8:11pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/8 "2015-01-20T20:11:37Z")

</div>

Can you go into your MousePressed Property and select Script Editor and show what has been generated there? That should show when the write is happening.

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 20, 2015, 11:37pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/9 "2015-01-20T23:37:30Z")

</div>

I have posted the script…

Actually there is two problem when using confirmation dialog, first, the value changed before i click yes.  
second, when i use this function in momentary button, the value stay at 1 after you click yes or no, momentary button should back to 0.

---

<div class="post-metadata">

**Author:** ![jmartell](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jmartell](https://forum.inductiveautomation.com/u/jmartell)\
**Post date:** [January 23, 2015, 8:02pm UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/10 "2015-01-23T20:02:15Z")

</div>

There are two actions happening when you click the momentary button. The button automatically sets its Control Value property to the On Value for the required amount of time and then resets it. That is what the momentary button is supposed to do and you can’t really stop this from happening.

The button is also going to run your mouse click event script. Your script is separate from the momentary action of the button. Your script asks for confirmation (not the default action of the button), and your script will write a value to the specified property (not the default action of the button). Your script has no instructions to reset the value.

If you don’t have anything bound to the button’s control value, then don’t worry about what that is doing. In your script you are modifying a property of a UDT type. Focus on making that set and then reset. I used the following script still on the button’s click event to achieve what I think you are after:

[code]if system.gui.confirm(u’Are you sure?’, ‘Confirm’):  
event.source.parent.MOV.CLOSE = 1

```
def reset():
  import system
  event.source.parent.MOV.CLOSE = 0

system.util.invokeLater(reset, 5000)

```

[/code]

---

<div class="post-metadata">

**Author:** ![illank86](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@illank86](https://forum.inductiveautomation.com/u/illank86)\
**Post date:** [January 27, 2015, 10:21am UTC](https://forum.inductiveautomation.com/t/security-confirmation-dialog/9545/11 "2015-01-27T10:21:45Z")

</div>

Sorry for the late reply…

Thanks jmartell, the script did the job… PERFECT

Thank you
