# How to manage the text change scripting trigger when the designer goes to preview mode

**URL:** <https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [March 27, 2022, 2:00pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681 "2022-03-27T14:00:28Z")\
**Posts on this page:** 7\
**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 27, 2022, 2:00pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/1 "2022-03-27T14:00:28Z")

</div>

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

```auto
	event.source.parent.getComponent('Lot').getComponent('AFrame1').selectedValue=-1
	event.source.parent.getComponent('Lot').getComponent('AFrame2').selectedValue=-1

```

case 1:  
I have a scritping , my purpose when the **label text change** then it will be triggered.  
But when I test this code, if I click the designer into previous mode,  
I don’t want it trigger but it **actually trigger**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/e/8e88a8b53ead5bc8b1fdf822d6e2710563eb68f8.png)  
case 2:  
In this project, if I put this code in another _ **input text’s** _ event scripting, when I click the previous mode  
I want it trigger but it actually **don’t trigger**  
I use the same code under the condition.

```auto
if event.propertyName=='text':

```

how to scripting then I can make it work as my expect?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 27, 2022, 3:22pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/2 "2022-03-27T15:22:06Z")

</div>

Seems a bit strange. Without being at my laptop I can’t test, but in your scripts maybe print out the event.propertyName so you can see what properties are changing. Make sure you identify in the print statement which component the change belongs to, eg

```auto
print "component 1:", event.propertyName

```

Then put it into preview mode and check the Console

---

<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 27, 2022, 5:12pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/3 "2022-03-27T17:12:59Z")

</div>

> [@yifeiliu08](#):
>
> if I click the designer into previous mode,

I don't understand that sentence. Can you explain more?

* * *

Tip: I think you should watch the RealPars video series [What is a High-Performance HMI](https://www.youtube.com/watch?v=5GEvFF8pGlc) where they discuss use of colour, clutter, and the affect on the operator.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 27, 2022, 7:43pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/4 "2022-03-27T19:43:31Z")

</div>

Preview mode

---

<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 28, 2022, 1:26am UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/5 "2022-03-28T01:26:49Z")

</div>

> [@nminchin](#):
>
> `print "component 1:", event.propertyName`

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d9bb78c70af56a69f293abf126fe4cb758bcd4e8.png)  
I have try with TextFiled and Label, when I use your code, and make the designer into Preview mode, I found the reason in the Output Console, different component will trigger the different propertyName change while the designer come into Preview mode

---

<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 28, 2022, 1:33am UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/6 "2022-03-28T01:33:40Z")

</div>

Preview mode  
thanks for your tips.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 28, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/how-to-manage-the-text-change-scripting-trigger-when-the-designer-goes-to-preview-mode/57681/7 "2022-03-28T15:21:21Z")

</div>

Whenever you enter preview mode, the designer sets the locale to whatever your preview locale is, which fires a translation event that triggers the text change.

The simplest solution would be to check if you’re in a designer in your `propertyChange` event:  
[https://docs.inductiveautomation.com/display/DOC81/system.util.getSystemFlags](https://docs.inductiveautomation.com/display/DOC81/system.util.getSystemFlags)
