# "Enabled" property binding

**URL:** <https://forum.inductiveautomation.com/t/enabled-property-binding/1672>\
**Category:** Ignition\
**Created:** [March 21, 2010, 3:43pm UTC](https://forum.inductiveautomation.com/t/enabled-property-binding/1672 "2010-03-21T15:43:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [March 21, 2010, 3:43pm UTC](https://forum.inductiveautomation.com/t/enabled-property-binding/1672/1 "2010-03-21T15:43:45Z")

</div>

I’ve got a situation where the user can add new product IDs to the database, and the first thing I do is check if the ID already exists (there are a bunch of other qualifiers, but that’s all you need for this example). If the ID exists, I force the number they entered back to zero.

The button’s “enabled” property is bound to the int in the numeric input box being greater than zero. But, it doesn’t work correctly when I programatically set the number back to zero. To get it to go back to disabled again, I have to open the bindings dialog and close it again, and then it refreshes.

I also tried programatically setting “enabled” to 0, but that didn’t work either. Obviously, the expression binding never sees an update from one value to another and back to zero. Is that how this is supposed to work? I know I could just drop the binding and control it all programatically, but the binding would be cleaner. Can I force a refresh of the binding?

I’ve attached a window so you can see what I mean. If you enter any number but “2”, the “test” button should be enabled. If you enter “0” or “2”, the button should go disabled.  
[Enabled.zip](https://us1.discourse-cdn.com/inductiveautomation/original/1X/7805f897ab878bbc6ab6d17867edc0d55a3fd00b.zip) (4.46 KB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 22, 2010, 4:16pm UTC](https://forum.inductiveautomation.com/t/enabled-property-binding/1672/2 "2010-03-22T16:16:29Z")

</div>

I think your only problem is that you’re setting intValue from within the propertyChange of intValue itself. This is breaking the ‘rules’ as far as event propogation goes. So you think: “its changing to a 2, and then I change it back to a 0”, but what really happens is that “It starts changing to a 2, then I change it to a 0, and then the change to 2 completes”.

Throw the reset to zero in an [invokeLater](http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?system_util_invokelater.htm) call, and you should be all set, like this:

`if event.propertyName == 'intValue':
	if event.source.intValue ==2:
		def reset(event=event):
			event.source.intValue = 0
		system.util.invokeLater(reset)`
