# Script Syntax for disabling a text field after the text has been updated

**URL:** <https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542>\
**Category:** Ignition\
**Tags:** vision, scripting\
**Created:** [August 7, 2023, 10:16pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542 "2023-08-07T22:16:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger\_Denison](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Roger\_Denison](https://forum.inductiveautomation.com/u/Roger_Denison)\
**Post date:** [August 7, 2023, 10:16pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/1 "2023-08-07T22:16:51Z")

</div>

I would like to have a method where I can enter a string into a text field and then disable the text field so that the string is "locked". I can reenable the field later by clicking another button.

TIA.

---

<div class="post-metadata">

**Author:** ![Roger\_Denison](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Roger\_Denison](https://forum.inductiveautomation.com/u/Roger_Denison)\
**Post date:** [August 7, 2023, 10:18pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/2 "2023-08-07T22:18:27Z")

</div>

(The text field is 'locked' when I press the Enter key. So basically, when the text property is updated.)

---

<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:** [August 7, 2023, 10:18pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/3 "2023-08-07T22:18:28Z")

</div>

Please edit your question and add the Perspective or Vision tag so we know how to answer. Thanks.

---

<div class="post-metadata">

**Author:** ![Roger\_Denison](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Roger\_Denison](https://forum.inductiveautomation.com/u/Roger_Denison)\
**Post date:** [August 7, 2023, 10:20pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/4 "2023-08-07T22:20:17Z")

</div>

This is for Vision. I'm looking at general syntax to do this. No tags involved.

---

<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:** [August 7, 2023, 10:22pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/5 "2023-08-07T22:22:07Z")

</div>

I've added the tag in the question title.

---

<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:** [August 7, 2023, 10:22pm UTC](https://forum.inductiveautomation.com/t/script-syntax-for-disabling-a-text-field-after-the-text-has-been-updated/77542/6 "2023-08-07T22:22:13Z")

</div>

If `Defer Updates` is true, then you would just add a script to the `propertyChange` event handler, something like:

```python
if event.propertyName == "text":
	event.source.editable = False

```
