# Perspective dropdown deselect

**URL:** <https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [March 22, 2022, 4:24am UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445 "2022-03-22T04:24:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [March 22, 2022, 4:24am UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/1 "2022-03-22T04:24:23Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/4234447b381d3bbb4dcaaade36b3f64aa055d54a.png)  
In vision dropdown if I want to reset the dropdown list, I can just set the SelectValue=-1 by scripting, I can also set the no selection data

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90c5f0a89f046f33587535ab2ad70fee997a7ea6.png)  
I don’t knwo how to realize the same function in the perspective dropdown List

---

<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:** [March 22, 2022, 7:06am UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/2 "2022-03-22T07:06:42Z")

</div>

![Dropdown resest](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a374019e1d2437ace56b8a6b986e85a109ce42a.gif)  
Set the value to null (which is _None_ in Python). Here the reset button has the code,  
`self.getSibling("Dropdown").props.value = None`

A better solution would be to use sendMessage.  
On the button onClick action is

`system.perspective.sendMessage("dropdownReset", {}, scope = 'view')`

On the dropdown, right-click, Configure Scripts, Message Handlers, Add Handler, set Message Type = 'dropdownReset`, set the Listen Scope to 'View' (same as the sendMessage setting above) and add the following code.

`self.props.value = None`.

sendMessage protects you from breaking the functionality if you move any of the components into containers, etc.

* * *

> I can also set the no selection data.

The "Select..." text is set in `props.placeholder.text`.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [March 22, 2022, 10:57am UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/3 "2022-03-22T10:57:13Z")

</div>

thanks for your support, but 2 more question,

1. In vision, my button’s enable can binding to the dropdown’s selected value,like the following picture  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/a/4a00ad9bfb7bb6702e450608a63b6560dd35c9f5.png)  
how can this function realize in perspective

2 . In vision I can change the dropdown component’s background and forground color, but how to realize this funtion in perspective?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 22, 2022, 11:57am UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/4 "2022-03-22T11:57:16Z")

</div>

Did you try ?

I mean…

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

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9f5b5a88ee0915153905781ef1aa4dd63bf25019.png)

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [March 22, 2022, 12:46pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/5 "2022-03-22T12:46:37Z")

</div>

my dropdown list value is string, so your logic not works

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

My purpose is when the dropdown is reset to default show orange, if select a value show green.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 22, 2022, 12:55pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/6 "2022-03-22T12:55:14Z")

</div>

Well… this is not my logic, it’s the one you showed in your screenshot ! I just reproduced exactly what you were doing.

If your goal is to give something a specific color when nothing is selected in your dropdown, you can use pretty much the same expression, just check if `props.value` is null, or whatever the default value is. Here I check for null and empty string:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/994f60c4e91d6a3ad0b1badcbb16a22ded7b10b6.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/9/395555440b955efa9a8d1223d28e140b2d6e50ec.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/1/e119c99576d84fc396271d600d2d46673d72d230.png)

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [March 22, 2022, 1:09pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/7 "2022-03-22T13:09:17Z")

</div>

this color works , but how to handle when the props.value is null I need disable the botton function?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e73dc4b7dd2858dc202e044ffabd2416ec80facf.png)  
here is the sender  
I need when the prop.value is null  
disable the button enable function  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/5/65436649ebbca168e151f4ea73ee6e57c5cbefe2.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 22, 2022, 1:17pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/8 "2022-03-22T13:17:40Z")

</div>

Set the enabled property to either true or false.

Exactly the same binding only instead of mapping to a color you map it to a value. `false` when you want it disabled and `true` when you want it enabled.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 22, 2022, 1:27pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/9 "2022-03-22T13:27:39Z")

</div>

you put a red circle around the `meta.tooltip.enable` . this disabled the tooltip, not the button  
the button is at `props.enabled`

---

<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:** [March 22, 2022, 1:34pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/10 "2022-03-22T13:34:58Z")

</div>

This property:

![Button enable](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e4d74febbb9b178c065367af5b4507579dd1956.png)

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [March 22, 2022, 2:00pm UTC](https://forum.inductiveautomation.com/t/perspective-dropdown-deselect/57445/11 "2022-03-22T14:00:11Z")

</div>

@Transistor @victordcq @lrose @pascal.fragnoud thanks for all of your support, I just transfer from vision to perspective, a lot of logic have to change
