# Dropdown in perspective

**URL:** <https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 11, 2025, 2:30pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099 "2025-11-11T14:30:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 11, 2025, 2:30pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/1 "2025-11-11T14:30:52Z")

</div>

Hello,  
In Perspective, I would like to trigger a script when a value is deleted from a dropdown.

I don't know the name of the event.

Thank you

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 11, 2025, 2:34pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/2 "2025-11-11T14:34:10Z")

</div>

Do you mean when an item is no longer available in the options property, or when someone hits a clear button to set the selected value to None?

---

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 11, 2025, 2:38pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/3 "2025-11-11T14:38:18Z")

</div>

Hi,

The event when someone press the cross in the value of the dropdown

![Capture d’écran 2025-11-11 153731](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a9bab5bcfacb18622f56eb5331d4e035bbe13aa4.png)

---

<div class="post-metadata">

**Author:** ![vtran](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vtran](https://forum.inductiveautomation.com/u/vtran)\
**Post date:** [November 11, 2025, 3:01pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/4 "2025-11-11T15:01:39Z")

</div>

Since those are stored in `props.value` parameter and you want to trigger only when something is deleted, I would use a change script on `props.value`. Then compare the length of `previousValue.value` and `currentValue.value` to see if something was removed from it

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	# grab the previous and current array length, default to 0 if null
	previousLen = len(previousValue.value) if previousValue.value else 0
	currentLen = len(currentValue.value) if currentValue.value else 0
	
	# if array length reduces
	if previousLen > currentLen:
		# default current array to [] in case of null
		currentValueArray = currentValue.value or []
		# find the difference aka whatever was removed if needed
		difference = [value for value in previousValue.value if value not in currentValueArray]

		system.perspective.print('Array length reduces from %s to %s' % (previousLen, currentLen))
		system.perspective.print(difference)

```

---

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 11, 2025, 3:05pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/5 "2025-11-11T15:05:28Z")

</div>

Thank you for your reply, sorry but where must I write the script ?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 11, 2025, 3:06pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/6 "2025-11-11T15:06:44Z")

</div>

Right click on the value prop in the property editor, then you’ll see the option to add a change script.

---

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 11, 2025, 3:12pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/7 "2025-11-11T15:12:06Z")

</div>

Thanks for your help

Regards

---

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 12, 2025, 11:00am UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/8 "2025-11-12T11:00:45Z")

</div>

Hello,

If the dropdown is empty, the previousValue has no value.How to fix it?

Thanks

---

<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:** [November 12, 2025, 11:02am UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/9 "2025-11-12T11:02:22Z")

</div>

What is the error message?

---

<div class="post-metadata">

**Author:** ![ecurreaux](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@ecurreaux](https://forum.inductiveautomation.com/u/ecurreaux)\
**Post date:** [November 12, 2025, 11:05am UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/10 "2025-11-12T11:05:39Z")

</div>

'NoneType' object has no attribute 'value'

---

<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:** [November 12, 2025, 11:09am UTC](https://forum.inductiveautomation.com/t/dropdown-in-perspective/112099/11 "2025-11-12T11:09:11Z")

</div>

Just test for it. Something like,

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if not previousValue:
		return
	# grab the previous and current array length, default to 0 if null
	previousLen = len(previousValue.value) if previousValue.value else 0
	currentLen = len(currentValue.value) if currentValue.value else 0
	etc.

```
