# Auto complete options for text input

**URL:** <https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 11, 2025, 9:10am UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497 "2025-03-11T09:10:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmadariaga](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmadariaga/32/63201_2.png) [@mmadariaga](https://forum.inductiveautomation.com/u/mmadariaga)\
**Post date:** [March 11, 2025, 9:10am UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/1 "2025-03-11T09:10:52Z")

</div>

Hi, I'm creating a component where the user enters a formula to retrieve a value. The user types in a string like:

> if(diam\>10, 5, 4) \* weight + density / 100 \* aux\_function\_1(diam)

- diam, weight and density come from a dict variables.

- aux\_function\_1 comes from a dict aux\_functions.

I'd like to display the available options as the user types in the formula, if possible with an icon indicating if it's a function or a variable:

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

Is this possible? Maybe with js injection? I thought of using a dropdown but I find it rather inconvenient as the user would've to define the gaps in advance.

[CodeMirror](https://codemirror.net/) offers exactly this, so a way to implement it in perspective would be ideal.

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [March 11, 2025, 1:10pm UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/2 "2025-03-11T13:10:30Z")

</div>

There's an exchange resource that does something somewhat similar:

> **[Ignition Exchange](https://inductiveautomation.com/exchange/2617/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

Perhaps it can give you some ideas. It looks like it allows the user to tab to complete too.

JS injection would be tricky with text fields because editing the HTML doesn't actually change the property value on the gateway side. You'd have to either only use js injection for display purposes or [write to some session props with on change scripts on them](https://forum.inductiveautomation.com/t/javascript-inject-in-perspective-have-fun/65805).

---

<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 11, 2025, 1:50pm UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/3 "2025-03-11T13:50:39Z")

</div>

I have never looked into this, but i speed purposes, all the autocomplete logic should happen in the frontend. having an autocomplete that is to slow because it has to go back and forth to the gateway would be useless...

Having everything in the frontend would however be quite some work to make, while possible this looks more on the level of a module than some injected js.

Unless there are only a very few options to autofill, but in which case why bother with it...

---

<div class="post-metadata">

**Author:** ![mmadariaga](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmadariaga/32/63201_2.png) [@mmadariaga](https://forum.inductiveautomation.com/u/mmadariaga)\
**Post date:** [March 14, 2025, 10:16am UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/4 "2025-03-14T10:16:18Z")

</div>

I'd like to use it for 5-15 options, just so that the user doesn't type in something incorretly. I might use the ignition exchange resource to autofill plus a table to display the options on the side... not as clean but it will do the job.

---

<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 14, 2025, 10:33am UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/5 "2025-03-14T10:33:20Z")

</div>

> [@victordcq](#):
>
> having an autocomplete that is to slow because it has to go back and forth to the gateway would be useless.

Doesn't your search engine auto-complete do this across the Internet? Doing it within a company network should be even faster - provided the gateway has the stamina and adequate optimisation. (I don't have much of a clue how the search engines are optimised.)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 14, 2025, 12:48pm UTC](https://forum.inductiveautomation.com/t/auto-complete-options-for-text-input/103497/6 "2025-03-14T12:48:52Z")

</div>

> [@Transistor](#):
>
> Doesn't your search engine auto-complete do this across the Internet?

They preload several likely keystrokes to keep ahead of you. If you type something unpredicted they hesitate for the extra round trip.
