# Running a namedquery from a TextField

**URL:** <https://forum.inductiveautomation.com/t/running-a-namedquery-from-a-textfield/53869>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [December 8, 2021, 4:42am UTC](https://forum.inductiveautomation.com/t/running-a-namedquery-from-a-textfield/53869 "2021-12-08T04:42:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael.Usry](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Michael.Usry](https://forum.inductiveautomation.com/u/Michael.Usry)\
**Post date:** [December 8, 2021, 4:42am UTC](https://forum.inductiveautomation.com/t/running-a-namedquery-from-a-textfield/53869/1 "2021-12-08T04:42:48Z")

</div>

When a user enters a string in a TextField I’m looking for the update query to run either when they press enter or clicking someplace on the screen. What’s the correct Event(s) I should use for the script? Nothing seems to be working.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 8, 2021, 5:45am UTC](https://forum.inductiveautomation.com/t/running-a-namedquery-from-a-textfield/53869/2 "2021-12-08T05:45:31Z")

</div>

Is there a reason you wouldn’t want to put your logic in an OnChange event for the property?

```auto
# Setting a sibling Table component to the results of a query run whenever the prop changes
if currentValue and currentValue.value != previousValue.value:
    self.getSibling("Table").props.data = system.db.runPrepQuery(<query>, [currentValue.value])

```

---

<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:** [December 8, 2021, 3:15pm UTC](https://forum.inductiveautomation.com/t/running-a-namedquery-from-a-textfield/53869/3 "2021-12-08T15:15:11Z")

</div>

Failing a property change, it sounds like `onBlur()` should be what you want? The inverse of `onFocus`.
