# Save value of text\_field in the view

**URL:** <https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609>\
**Category:** Rails\
**Created:** [January 25, 2009, 8:16pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609 "2009-01-25T20:16:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 25, 2009, 8:16pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/1 "2009-01-25T20:16:20Z")

</div>

hello everybody

How I save de value of text\_fiel in the same view

\<%= f.text\_field :precio\_compra, :size=\> 10 %\>

How do it???

thanks for all

---

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 25, 2009, 10:26pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/2 "2009-01-25T22:26:22Z")

</div>

Could you please elaborate a little bit more?

What do you mean by “saving in the same view”?

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

On Sun, Jan 25, 2009 at 4:16 PM, Maite P.

---

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 26, 2009, 10:50am UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/3 "2009-01-26T10:50:26Z")

</div>

MaurÃ­cio Linhares wrote:

> Could you please elaborate a little bit more?
> 
> What do you mean by “saving in the same view”?

I want to catch the value of num\_titulos for pass this value to action  
comprueba, but I donÂ´t know how I do it.

td\>

**numero de titulos a comprar:** \<%= f.text\_field  
:num\_titulos, :size=\> 10 %\>

**Elija el precio al que compro:** \<%= f.text\_field :precio\_compra, {:size=\> 10, :onchange =\> "#{remote\_function(:url=\>{:controller=\> "accions", :action=\> "comprueba"},:with =\>"'valor='+ value")}"} %\>

thanks for all

---

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 26, 2009, 5:48pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/4 "2009-01-26T17:48:08Z")

</div>

Ryan B. wrote:

> If it is inside a form and that form points to the right action then  
> that field will be passed in via the params hash

ok it is inside a form but I want before to click on the bottom submit I  
want to catch the value to pass for :onchange

:onchange =\>  
"#{remote\_function(:url=\>{:controller=\> “accions”, :action=\>  
“comprueba”}

thanks again

---

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 26, 2009, 1:40pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/5 "2009-01-26T13:40:03Z")

</div>

If it is inside a form and that form points to the right action then  
that field will be passed in via the params hash

On 26/01/2009, at 19:50, Maite P. \<rails-mailing-list@andreas-

---

<div class="post-metadata">

**Author:** ![maite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@maite](https://www.ruby-forum.com/u/maite)\
**Post date:** [January 28, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/save-value-of-text-field-in-the-view/158609/6 "2009-01-28T19:25:35Z")

</div>

Hello list I have the same problem yet

I dont catch value of text\_field in the same erb.html file.

any idea???

thanks again.
