# Perspective Message Handler on Prop Value change script

**URL:** <https://forum.inductiveautomation.com/t/perspective-message-handler-on-prop-value-change-script/89239>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [April 22, 2024, 8:14pm UTC](https://forum.inductiveautomation.com/t/perspective-message-handler-on-prop-value-change-script/89239 "2024-04-22T20:14:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [April 22, 2024, 8:14pm UTC](https://forum.inductiveautomation.com/t/perspective-message-handler-on-prop-value-change-script/89239/1 "2024-04-22T20:14:09Z")

</div>

I am trying to have a text field within my project be focused after a labels text prop has changed value. I am able to get the message handler to work with an "onClick" event but can't seem to get it to work on a prop change script.

Here is my code:

On the textbox I want to be focused

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

On Label's text property change script:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/2/5253d4bc7737400b356b756dc17228ca93dbfca5.png)

On buttons, "onClick" event (This one works, line 14 is the relevant one):

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

Any information would be helpful.

---

<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:** [April 22, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/perspective-message-handler-on-prop-value-change-script/89239/2 "2024-04-22T20:43:11Z")

</div>

I tested `sendMessage` from a change script and it worked fine. Check your logs and see if any errors are happening before the provide focus line.

Also, you can change your script to be more succinct using `in`

```python
if self.custom.prgrm in (2,5,6):
    # do something

```

Also, you should use the `onActionPerformed` event for buttons, not `onClick`.
