# Can this be done? Choose and Add

**URL:** <https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223>\
**Category:** Ask for Help\
**Tags:** ai, choice\
**Created:** [January 15, 2025, 6:41pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223 "2025-01-15T18:41:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 15, 2025, 6:41pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/1 "2025-01-15T18:41:43Z")

</div>

I’d like a form that allows my user to choose from a list of contacts which is stored in my contacts table, but if they do not find a current contact allow them to add a new record.

I tried using the AI component and I could get it to present the way I want, and it looks exactly as I expect, but I cannot get it to pull the current list of contacts, it just places random names in that space. This is connected to the table Contacts.

 ![Screenshot 2025-01-15 at 10.22.02 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/2/f2179338111024829d6fc7c4a9ec49277963e40b.png)  
 ![Screenshot 2025-01-15 at 10.40.22 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/e/7e7e5b9c352a487be8183ec60baa30b590ee7e4f.png)

---

<div class="post-metadata">

**Author:** ![dias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dias/32/75988_2.png) [@dias](https://community.glideapps.com/u/dias)\
**Post date:** [January 15, 2025, 8:44pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/2 "2025-01-15T20:44:52Z")

</div>

Would placing a “Add New Contact” button component work in this case, or does it have to be embedded into the list?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 16, 2025, 12:27am UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/3 "2025-01-16T00:27:24Z")

</div>

> **[Thinh Dinh on LinkedIn: Text entries with suggested choices is the latest...](https://www.linkedin.com/posts/thinhcdinh_text-entries-with-suggested-choices-is-the-activity-7283111476301570048-x42r?utm_source=share&utm_medium=member_desktop)**
>
> Text entries with suggested choices is the latest innovation LowCode Agency can offer to clients, using Glide's AI Component.
> 
> One client of us had a use case:…

You can try my setup here.

Prompt this into your AI component as a first prompt.

```auto
<body x-data="state" class="" :class="{ 'cursor-pointer': hasBodyAction }" style="height: auto !important;" data-iframe-overflow="">
    <div x-show="themeLoaded" class="@container w-full body-base antialiased" style="">
      <div :class="{ 'px-4 py-1 sm:px-5 md:px-6 lg:px-7 xl:px-8': mode === 'standalone' }" class="px-4 py-1 sm:px-5 md:px-6 lg:px-7 xl:px-8">
        <div class="w-full">
        <label for="license-plate" class="block text-[rgba(0,0,0,0.95)] text-xs font-semibold mb-2 text-[12px]">
          14. License Plate No.<span class="text-[11px] font-medium text-[rgba(51,51,51,0.70)] px-2 py-1 rounded-full">Required</span>
        </label>
        <div x-data="{ suggestions: [] }" class="relative">
          <input type="text" id="license-plate" x-model.trim="inputPlate" x-on:input="suggestions = inputPlate ? platesBase.split(',').map(plate => plate.trim()).filter(plate => new RegExp(inputPlate, 'i').test(plate)).slice(0, 5) : []" class="w-full px-4 py-2 bg-[#e3e3e3] text-gray-900 rounded-lg focus:outline-none focus:ring-2 focus:ring-accent text-sm" placeholder="Enter license plate number">
          <ul x-show="suggestions.length > 0" class="absolute z-10 w-full mt-1 bg-background border border-gray-200 rounded-lg shadow-lg" data-iframe-overflow="" style="display: none;">
            <template x-for="suggestion in suggestions" :key="suggestion">
              <li x-text="suggestion" @click="inputPlate = suggestion.trim(); suggestions = []" class="px-4 py-2 cursor-pointer hover:bg-gray-100 text-gray-600"></li>
            </template>
          </ul>
        </div>
      </div>
      </div>
    </div>
  
  <script src="//cdn.jsdelivr.net/npm/@iframe-resizer/child@5.2.1"></script>
<div style="clear: both; display: block; height: 0px;"></div></body>

```

Then connect two things:

 ![CleanShot 2025-01-16 at 07.26.49@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b3572d3b9b0014801ecb3069aab885618462a2b4.png)

A comma-delimited column of your choices.  
A field where you want the choice to write to.

 ![CleanShot 2025-01-16 at 07.27.14@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/0/2070bd516df4b36f473fe3115266bd6b0a3b0606.png)

---

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 16, 2025, 12:44am UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/4 "2025-01-16T00:44:39Z")

</div>

It does not have to be embedding in the list, but the way the AI returned it (obviously with the wrong list) is perfectly how I’d do it in a third party form so it’s a nice comfortable way to do it. Just wish it could find my list easily!

---

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 16, 2025, 12:45am UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/5 "2025-01-16T00:45:08Z")

</div>

Thank you I will spend some time on this tomorrow and may be back with more questions!

---

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 18, 2025, 5:13pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/6 "2025-01-18T17:13:32Z")

</div>

Is this the right code? I’m getting an output about license plates, not fed ex or shipping related something.

Truthfully about to lose my brain over not being able to figure out something that is so completely simple in even JotForms. Look at a list, select from list and use the field to connect the relation, but if the relation doesn’t exist open a form to add it. Why is this so hard for me? I’ve watched too many videos and read too many vague posts to figure it out so I’m just to the point of confusion now.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 18, 2025, 5:46pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/7 "2025-01-18T17:46:37Z")

</div>

If you look at @ThinhDinh’s code, it’s specifically for license plates, but it’s the same concept. You can either adjust the code for your use or just ask the AI to change what you want to be different.

---

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 18, 2025, 6:14pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/8 "2025-01-18T18:14:53Z")

</div>

I’m only getting a list separated by commas when I use this code. I’m not super familiar with using code for this type of thing and that’s obviously a limitation to my skillset. I pasted the code exactly as ThinhDinh posted and then I changed the fields, not names. I still only get a comma separated list from the joined list I created.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/d/bd7da091f5f95dc888ada1283049c67b795977ba.png)

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 18, 2025, 10:05pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/9 "2025-01-18T22:05:55Z")

</div>

I find that the AI component behaves differently inside of an edit/form screen. Sometimes it loses context. Is that what’s happening here you think?

---

<div class="post-metadata">

**Author:** ![Michelle\_Pointer1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/michelle_pointer1/32/83637_2.png) [@Michelle\_Pointer1](https://community.glideapps.com/u/Michelle_Pointer1)\
**Post date:** [January 18, 2025, 11:34pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/10 "2025-01-18T23:34:07Z")

</div>

That’s a good observation. I did try to follow your video on building a beastly choice component in my form a couple of days ago, I could get the component to build and look how I wanted it to look, but I could not get it to accept any data or populate any of my tables. I gave up on it, but the use case I have seems to be something many businesses need. One location with multiple and possibly changing contacts - in my case, its often GM’s who are moving around to different restaurants or stores.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 18, 2025, 11:50pm UTC](https://community.glideapps.com/t/can-this-be-done-choose-and-add/79223/11 "2025-01-18T23:50:55Z")

</div>

Is it possible for you to share access to that team to me in a personal message so I can go in and see what I can do?
