# Search on Textbox Component

**URL:** <https://community.thunkable.com/t/search-on-textbox-component/1655222>\
**Category:** Questions about Thunkable X\
**Tags:** textbox, search, data-source\
**Created:** [December 15, 2021, 6:42pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222 "2021-12-15T18:42:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 15, 2021, 6:42pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/1 "2021-12-15T18:42:29Z")

</div>

Hello! I got stuck at this problem where as I input/type something in the marked textbox(in images) , suppose typing into client name, so as i type into the textbox, it should search if that particular client is in the database or not. If it’s there, then it should fill out all other textboxes (\< in the image) with respective data from column. If that particular data is not present than I enter the data manually.  
 ![WhatsApp Image 2021-12-16 at 00.07.06](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/1/d17cd282bd542c9a149a311c1e66e84e78313096.jpeg)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [December 15, 2021, 7:08pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/2 "2021-12-15T19:08:00Z")

</div>

To see how you can implement a search you can learn from this sample project

[https://x.thunkable.com/projectPage/600c2ce7f153060012143ac4](https://x.thunkable.com/projectPage/600c2ce7f153060012143ac4)

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 16, 2021, 5:26am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/3 "2021-12-16T05:26:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/9/79fe9eb3a629cd4d41f0334ee4d1644da43920c1.png)

Screen goes blank and shows something went wrong.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 16, 2021, 6:27am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/4 "2021-12-16T06:27:39Z")

</div>

I believe you are causing the app to crash by changing the value of the text input’s text in a loop while at the same time checking to see if the value has changed. The loop is going to change the value which is going to restart the loop which is going to change the value which is going to restart the loop which is –— crash!

If you want to assign `Title Case [app variable currentRow]` to something, assign it to a different label or text input.

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 16, 2021, 6:31am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/5 "2021-12-16T06:31:28Z")

</div>

It’s Still crashing.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 16, 2021, 8:16am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/6 "2021-12-16T08:16:51Z")

</div>

If you don’t share your blocks then I don’t know how to help you. There could be ten different reasons why it’s crashing. I don’t even know if you made the changes I suggested.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [December 16, 2021, 8:19am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/7 "2021-12-16T08:19:53Z")

</div>

You have two mistakes in your block

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/1/7175a3ed5bfbc1be6dceb037cec084c3beb24f1b.png)  
The first block for `list of values....` should be outside of the `Changes` block.

The `for each loop ....` should use internal variables. You are using `app variable` for it.

Fix these two issues and then check. They might not be the cause of the crash but they have to be fixed for the project to run smoothly.

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 16, 2021, 3:33pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/8 "2021-12-16T15:33:43Z")

</div>

Here’s project link. In order form screen, i want to search client name text box. I have placed data viewer list just below that text box with visibility false. And have done all blocks in change event of client textbox.

[https://x.thunkable.com/copy/8531abf21429f9b05c1a6a7fdee14382](https://x.thunkable.com/copy/8531abf21429f9b05c1a6a7fdee14382)

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 16, 2021, 3:35pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/9 "2021-12-16T15:35:40Z")

</div>

I tried changing, I have taken clientName variable to open screen event. Now, it’s not showing data viewer at all.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 16, 2021, 4:00pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/10 "2021-12-16T16:00:02Z")

</div>

The problem is still the same… you need to change this:

 ![Screen Shot 2021-12-16 at 7.58.44 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/9/09f0ddb81a313d93fdee6de549c46550cee62a3f.png)

At least to test it and know if that’s causing the problem (I think it is).

I also don’t see where you are setting the initial value of `app variable currentRow`. It seems like you’re checking to see if it contains the text input text but the value of `app variable currentRow` is null.

**Edit:** okay, you changed the loop variable to `i`. Now you need to replace `app variable currentRow` with `i`.

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 16, 2021, 4:45pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/11 "2021-12-16T16:45:51Z")

</div>

ClientName textbox problem solved. Can you please go through this particular block once again. I don’t know how can i explain this. but when i type two letters, if the data and two letters i type matches, it doesn’t ask me to select and automatically the text box is filled with matching data.  
Even data list viewer is not being visible.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 16, 2021, 5:41pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/12 "2021-12-16T17:41:36Z")

</div>

Please share a link to your updated project.

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 17, 2021, 4:15am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/13 "2021-12-17T04:15:52Z")

</div>

[https://x.thunkable.com/copy/4da29c5a379bf5437cb91f5b1b4353f0](https://x.thunkable.com/copy/4da29c5a379bf5437cb91f5b1b4353f0)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 17, 2021, 5:47am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/14 "2021-12-17T05:47:33Z")

</div>

You have not fixed the first problem here:

> [@Search on Textbox Component](https://community.thunkable.com/t/search-on-textbox-component/1655222/7):
>
> You have two mistakes in your block [image] The first block for list of values.... should be outside of the Changes block. The for each loop .... should use internal variables. You are using app variable for it. Fix these two issues and then check. They might not be the cause of the crash but they have to be fixed for the project to run smoothly.

You have not fixed this problem:

> [@Search on Textbox Component](https://community.thunkable.com/t/search-on-textbox-component/1655222/10):
>
> The problem is still the same… you need to change this: At least to test it and know if that’s causing the problem (I think it is). I also don’t see where you are setting the initial value of app variable currentRow. It seems like you’re checking to see if it contains the text input text but the value of app variable currentRow is null. Edit: okay, you changed the loop variable to i. Now you need to replace app variable currentRow with i.

> [@tatiang](#):
>
> I believe you are causing the app to crash by changing the value of the text input’s text in a loop while at the same time checking to see if the value has changed. The loop is going to change the value which is going to restart the loop which is going to change the value which is going to restart the loop which is –— crash!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 17, 2021, 6:07am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/15 "2021-12-17T06:07:00Z")

</div>

There’s a separate problem with your search, though.

Let’s say I have a client named Jennifer and a client named Jenny. If I type “Jen”, what do you want to appear in the Client Name field? Because they both match the search term but they can’t both be displayed.

**Edit:** I see your Data Viewer List (DVL) now. I would do it this way:

1. The user types in a search term.
2. The DVL pops up matching names – I would probably use a List Viewer instead but that’s just me… I know @muneer used a DVL in his demo.
3. The user taps on a name in the DVL.
4. The client name field is filled with the name that was tapped.

Right now, you’re doing 1+2 and then filling the client name field with one of the matching names without user input.

The thing is… @muneer already made you a working demo so I’m not sure how much more I can help here.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [December 17, 2021, 10:42am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/16 "2021-12-17T10:42:17Z")

</div>

Another thing to consider is the maximum number of expected entries. If few 10s then a dropdown list would be ideal for the task. You do not need a search box.

This demo project is based in a `List Viewer` and provides a replacement for a dropdown menu.  
[https://x.thunkable.com/projectPage/5fce83a95373b000115a9279](https://x.thunkable.com/projectPage/5fce83a95373b000115a9279)

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 17, 2021, 6:14pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/17 "2021-12-17T18:14:46Z")

</div>

What I actually want is, when I type in textbox, if in data base the name exist it should show me the data viewer and let me choose that data, and if there’s no data then it should not show me data viewer at all. Plus I used data viewer because I needed one more column to confirm I used Title & Subtitle format of data viewer, so that the data I’m selecting is concerned with the same client I’m looking for.  
I can’t put label at textbox because if the client is new I have to enter his/her name, and without entering I can’t store it into database. So, what i actually want is, when I type it should search

1. if there’s a match then it should show me data viewer and let me select.
2. if not then it should not show me data viewer.

I need code block for this. As I tried every thing, but nothing works.  
Every method,every block, every changes i did. It’s not working.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 17, 2021, 6:25pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/18 "2021-12-17T18:25:40Z")

</div>

I understand what you’re needing. It might be time to hire someone to help you if that’s going to make your project get finished sooner. Otherwise, you may need to take the time to work through the demos @muneer made and watch some tutorial videos to better understand how to use Thunkable. It took me several months to get to a point where I could understand other people’s blocks well enough to modify them for my own needs.

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 17, 2021, 7:04pm UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/19 "2021-12-17T19:04:29Z")

</div>

Sir! Only your knowledge can get me through this. 🙏

---

<div class="post-metadata">

**Author:** ![naitikjain99wz6mu](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@naitikjain99wz6mu](https://community.thunkable.com/u/naitikjain99wz6mu)\
**Post date:** [December 18, 2021, 6:12am UTC](https://community.thunkable.com/t/search-on-textbox-component/1655222/20 "2021-12-18T06:12:40Z")

</div>

Thank You, @tatiang for helping out. I searched and figured out that data viewer was not the best option for me out there. I did it with list viewer and it just worked. Thanks for telling me to look out for demos and tutorials, I saw and learned a lot. ❤

[Next page](https://community.thunkable.com/t/search-on-textbox-component/1655222.md?page=2)
