# Trouble with text\_field\_tag

**URL:** <https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384>\
**Category:** Rails\
**Created:** [October 5, 2007, 2:29am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384 "2007-10-05T02:29:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 2:29am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/1 "2007-10-05T02:29:42Z")

</div>

I am trying to implement a basic login page:

login.rhtml

1   
2 \<% form\_tag do %\>  
3 Name:  
4 \<%= text\_field\_tag :name, params[:name] %\>  
5 Password:  
6 \<%= password\_field\_tag :password, params[:password] %\>  
7 \<%= submit\_tag “Login” %\>  
8 \<% end %\>  
9

However, I’m getting the following error on line 4:

undefined method `tr’ for :name:Symbol

Am I using text\_field\_tag incorrectly? Here is my controller:

LoginController \< Application Controller

1 def login  
2 session[:user\_id] = nil  
3 if request.post?  
4 user = User.authenticate(params[:name], params[:password])  
5 if user  
6 session[:user\_id] = user.id  
7 redirect\_to(:action =\> “index”)  
8 else  
9 flash.now[:notice] = “Invalid user/password combination”  
10 end  
11 end  
12 end

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 2:39am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/2 "2007-10-05T02:39:21Z")

</div>

No, everything looks fine. I copy / pasted your view code into a test  
view and it rendered find. Can you paste the full error output?

Peter M. wrote:

> 7 \<%= submit\_tag “Login” %\>
> 
> 11 end  
> 12 end

–  
Sincerely,

William P.

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 3:23am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/3 "2007-10-05T03:23:58Z")

</div>

William P. wrote:

> No, everything looks fine. I copy / pasted your view code into a test  
> view and it rendered find. Can you paste the full error output?

Thanks for your interest William. The complete versions of the pages are  
here:

login\_controller.rb  
[http://pastie.caboo.se/103948](http://pastie.caboo.se/103948)

login.rhtml  
[http://pastie.caboo.se/103949](http://pastie.caboo.se/103949)

Here is my full error output:

NoMethodError in Login#login

Showing app/views/login/login.rhtml where line #8 raised:

undefined method `tr’ for :name:Symbol  
Extracted source (around line #8):

5: \<% form\_tag do %\>  
6:

7: Name:  
8: \<%= text\_field\_tag :name, params[:name] %\>  
9:

  
10:  
11: 

RAILS\_ROOT: /Users/petermarks/Documents/Rails/Orbus/config/…

Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/vendor/plugins/krjs/lib/krjs.rb:99:in `split_dom_id' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:109:in `controller\_method’  
#{RAILS\_ROOT}/vendor/plugins/krjs/lib/krjs.rb:128:in  
`viewer_method_eventattr' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:70:in `observer’  
#{RAILS\_ROOT}/vendor/plugins/krjs/lib/krjs.rb:24:in `tag' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/form_tag_helper.rb:94:in `text\_field\_tag’  
#{RAILS\_ROOT}/app/views/login/login.rhtml:8:in  
`_run_rhtml_47app47views47login47login46rhtml' #{RAILS_ROOT}/app/views/login/login.rhtml:5:in `\_run\_rhtml\_47app47views47login47login46rhtml’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel\_rails:16:in  
`load’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel\_rails:16  
Request

Parameters: None

Show session dump

Response

Headers: {“cookie”=\>[], “Cache-Control”=\>“no-cache”}

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 4:24am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/4 "2007-10-05T04:24:03Z")

</div>

Definitely odd, but based on the stack trace, the issue is with a plugin  
you have installed, krjs. I am not familiar with it, but according to  
the website:

Introducing the KRJS plugin  
[http://choonkeat.svnrepository.com/svn/rails-plugins/krjs/](http://choonkeat.svnrepository.com/svn/rails-plugins/krjs/), with less  
than 60 lines of patch to Rails’ ActionPack itself (_which probably  
means bugs are aplenty,_ would slow production sites to a crawl, and  
that its fresh from the oven too)

I would try removing this plugin or make sure you are running the latest  
version. Looks like the official site is here:  
[http://choonkeat.svnrepository.com/rails-plugins/trac.cgi/wiki](http://choonkeat.svnrepository.com/rails-plugins/trac.cgi/wiki)

Hope this helps.

Peter M. wrote:

> [Parked at Loopia](http://pastie.caboo.se/103948)  
> undefined method `tr’ for :name:Symbol
> 
> `\_run\_rhtml\_47app47views47login47login46rhtml’
> 
> Response
> 
> Headers: {“cookie”=\>[], “Cache-Control”=\>“no-cache”}

–  
Sincerely,

William P.

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 4:29am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/5 "2007-10-05T04:29:10Z")

</div>

Thank you very much for taking a look at this. I’ll uninstall kjrs and  
see what happens.

Thanks again,

Peter

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 8:16am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/6 "2007-10-05T08:16:13Z")

</div>

Hi Peter

Why don;t you take a look at acts\_as\_authenticated for guidance ?

On Oct 5, 8:29 am, Peter M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 8:40am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/7 "2007-10-05T08:40:17Z")

</div>

Uninstalling the kjrs plugin fixed this right up. Thanks again William.

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [October 5, 2007, 4:31am UTC](https://www.ruby-forum.com/t/trouble-with-text-field-tag/116384/8 "2007-10-05T04:31:40Z")

</div>

np, let me know what happens.

Peter M. wrote:

> Thank you very much for taking a look at this. I’ll uninstall kjrs and  
> see what happens.
> 
> Thanks again,
> 
> Peter

–  
Sincerely,

William P.
