# How to use observe\_field with text\_field

**URL:** <https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134>\
**Category:** Rails\
**Created:** [March 6, 2009, 3:50am UTC](https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134 "2009-03-06T03:50:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [March 6, 2009, 3:50am UTC](https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134/1 "2009-03-06T03:50:24Z")

</div>

#view  
\<%form\_tag :action=\>“some\_action” do -%\>

 \<%=observe\_field :user\_name,:update=\>"name\_response",:url=\> {:controller=\>"login",:action=\>"check\_name"},:with=\>"input\_name",:on=\>"blur"- %\> 

| \<%=text\_field "user","name"-%\> | |

 .... \<%end-%\> #view the check\_name method just renders a partial to response the ajax. the observe\_field works properly when it is used for select ,but not for text\_filed.i can not see any event to be invoked and not be able to debug.i have searched the forum to get answer,but seems not to find it about it.thanks.

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [March 6, 2009, 4:22am UTC](https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134/2 "2009-03-06T04:22:03Z")

</div>

Hi,

On Thu, 2009-03-05 at 18:49 -0800, daociyiyou wrote:

> #view  
> \<%form\_tag :action=\>“some\_action” do -%\>
> 
> \<%=observe\_field :user\_name,:update=\>"name\_response",:url=\>
> 
> You’re using form\_tag which means that the params hash is not bound to  
> an object. Both your text\_field syntax and your observe\_field syntax  
> assume otherwise. Make them match. Also, you’re headed for nothing but  
> trouble trying to use Ajax on tables. Microsoft controls how tables  
> work. And they don’t work well with Ajanx.
> 
> HTH,  
> Bill
> 
> | \<%=text\_field "user","name"-%\> | |

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [March 6, 2009, 8:05am UTC](https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134/3 "2009-03-06T08:05:26Z")

</div>

thanks.

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [March 6, 2009, 5:41pm UTC](https://www.ruby-forum.com/t/how-to-use-observe-field-with-text-field/162134/4 "2009-03-06T17:41:59Z")

</div>

On Thu, 2009-03-05 at 23:04 -0800, daociyiyou wrote:

> thanks.

You’re welcome.

Best regards,  
Bill
