# Capture TextInput value when button is clicked (search form)

**URL:** <https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557>\
**Category:** How-to Discussions\
**Created:** [October 25, 2016, 8:38pm UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557 "2016-10-25T20:38:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hello](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/hello/32/162_2.png) [@hello](https://forums.fusetools.com/u/hello)\
**Post date:** [October 25, 2016, 8:38pm UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/1 "2016-10-25T20:38:19Z")

</div>

Hi everyone. I was unable to do a proper search in the forum, but I am looking for advice on how to capute a TextInput class value when a Button class is clicked. Behind the click there will be a function that will forward the TextInput Value (basically a search field) and send it to another page (search results page) where the passed value will be submitted into a Fetch. Cracked my head for about 2 hours on this and could not get it to work. Thanks.

---

<div class="post-metadata">

**Author:** ![Bent](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bent/32/157_2.png) [@Bent](https://forums.fusetools.com/u/Bent)\
**Post date:** [October 25, 2016, 8:46pm UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/2 "2016-10-25T20:46:02Z")

</div>

Did you go through our getting started tutorial? It covers this as well as a lot of other useful stuff I think you’ll find interesting: [https://www.fusetools.com/docs/tutorial/mock-backend](https://www.fusetools.com/docs/tutorial/mock-backend)

---

<div class="post-metadata">

**Author:** ![hello](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/hello/32/162_2.png) [@hello](https://forums.fusetools.com/u/hello)\
**Post date:** [October 26, 2016, 9:27am UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/3 "2016-10-26T09:27:38Z")

</div>

I did actually, but it did not seem to be the solution I was looking for. I ended up with the following (ugly) solution:

```auto
function goSearch(arg) {
	var searchTerm = arg.data.searchInput._values[0];
	router.push("searchResults", searchTerm);
}

```

Since the data was in the **arg** object I could simply extract it. Then on the searchResults page I used **this.Parameter** to read the value and assign it to a variable.

---

<div class="post-metadata">

**Author:** ![Claudio\_Holanda](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/claudio_holanda/32/525_2.png) [@Claudio\_Holanda](https://forums.fusetools.com/u/Claudio_Holanda)\
**Post date:** [April 24, 2017, 12:49am UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/4 "2017-04-24T00:49:00Z")

</div>

> **Bent Stamnes wrote:**
> 
> Did you go through our getting started tutorial? It covers this as well as a lot of other useful stuff I think you’ll find interesting: [Fuse](https://www.fusetools.com/docs/tutorial/mock-backend)

I too had the same question recently. It turns our that sometimes you don’t want to assign Observable to a field, you just want a way to get its value without dealing with data binding. As far as I remember, this wasn’t covered in the tutorial.

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [April 24, 2017, 8:08am UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/5 "2017-04-24T08:08:15Z")

</div>

While it’s nice that you get stuff working by whatever means, I would like to point out that you _should_ do things the way they are supposed to be done. Otherwise you run the risk of your code breaking in future versions.

Since UX and JS run on separate threads, Observables are the proper way to ensure that everything gets across as intended.

---

<div class="post-metadata">

**Author:** ![Claudio\_Holanda](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/claudio_holanda/32/525_2.png) [@Claudio\_Holanda](https://forums.fusetools.com/u/Claudio_Holanda)\
**Post date:** [April 24, 2017, 1:07pm UTC](https://forums.fusetools.com/t/capture-textinput-value-when-button-is-clicked-search-form/6557/6 "2017-04-24T13:07:51Z")

</div>

> **Uldis wrote:**
> 
> Since UX and JS run on separate threads, Observables are the proper way to ensure that everything gets across as intended.

Now everything makes sense. I thought it was more of an “coding style” being enforced by Fuse, but there is actually a technical reason behind it. Will start using `Observable()` then.
