# Mouse-Clicked Scripting on Dropdown List

**URL:** <https://forum.inductiveautomation.com/t/mouse-clicked-scripting-on-dropdown-list/14195>\
**Category:** Ignition\
**Created:** [May 2, 2017, 11:20pm UTC](https://forum.inductiveautomation.com/t/mouse-clicked-scripting-on-dropdown-list/14195 "2017-05-02T23:20:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [May 2, 2017, 11:20pm UTC](https://forum.inductiveautomation.com/t/mouse-clicked-scripting-on-dropdown-list/14195/1 "2017-05-02T23:20:46Z")

</div>

Hey folks,

I’ve seen mention of this in previous posts and I wanted to see if there is a recommended solution.

Mouse clicked scripting appears to work on the dropdown list as long as I do not click on the dropdown button on the right side.

My script is simple, just logging the selected value to a custom property before the operator chooses a new value. I just need to ensure that if the dropdown button is clicked that the same value is logged.

Script below, 7.9.1.  
event.source.PreviousValue = event.source.selectedValue

Thanks!

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [May 3, 2017, 3:59am UTC](https://forum.inductiveautomation.com/t/mouse-clicked-scripting-on-dropdown-list/14195/2 "2017-05-03T03:59:40Z")

</div>

If what you need to do is set the PreviousValue custom property to the value previously selected then I recommend putting the following script in the propertyChange event in the dropdown component. This works really well.

```auto
if event.propertyName == "selectedValue":
	event.source.PreviousValue = event.oldValue

```

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [May 4, 2017, 9:11pm UTC](https://forum.inductiveautomation.com/t/mouse-clicked-scripting-on-dropdown-list/14195/3 "2017-05-04T21:11:34Z")

</div>

That worked like a charm, thank you!
