# Form\_tag not producing output

**URL:** <https://www.ruby-forum.com/t/form-tag-not-producing-output/78684>\
**Category:** Rails\
**Created:** [December 7, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684 "2006-12-07T20:48:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/1 "2006-12-07T20:48:40Z")

</div>

I’ve got two servers, both with Rails 1.1.6 on them. I’m trying to  
remove some of the newly-deprecated stuff in my app, and I’ve run into  
a problem. My login page used to look like this:

# Please Sign In

\<%= start\_form\_tag :action =\> ‘login’ %\>

```
<label for="user_login">Login:</label><br/>
<input type="text" name="user_login" id="user_login" size="30"

```

value=""/\>

```
<label for="user_password">Password:</label><br/>
<input type="password" name="user_password" id="user_password" 

```

size=“30”/\>

```
<br/>
<input type="submit" name="login" value="Login &#187;" 

```

class=“primary” /\>  
\<%= end\_form\_tag %\>

When I change to this :

\<% form\_tag :action =\> ‘login’ do %\>  
(…same form fields…)  
\<% end %\>

then on my production machine, I get no HTML output at ALL. No errors  
in the log file, nothing. The layout renders, and the HTML produced  
looks like this:

…

# Please Sign In

...

So the output of the whole \<% form\_tag :action… do %\> … \<% end %\>  
is just AWOL.

Now, on my development machine, these produce identical HTML output;  
the form shows up and works fine whether I use the old deprecated \<%=  
start\_form\_tag …%\> or the new-and-hotness \<% form\_tag … do %\>.

Can someone shed some light on where I might look to find the problem?  
It seems perhaps I don’t have the proper version of _something_ on  
one of the servers, but frankly, I don’t know how to determine that.

Thanks for any suggestions!

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 9:04pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/2 "2006-12-07T21:04:50Z")

</div>

Ryan W. wrote:

> I’ve got two servers, both with Rails 1.1.6 on them. I’m trying to  
> remove some of the newly-deprecated stuff in my app, and I’ve run into  
> a problem. My login page used to look like this:

[snip]

> When I change to this :
> 
> \<% form\_tag :action =\> ‘login’ do %\>  
> (…same form fields…)  
> \<% end %\>

The difference might be \<%= instead of \<%

Use \<%= if you want the output rendered.

Long  
www.edgesoft.ca/blog/read/2

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 9:22pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/3 "2006-12-07T21:22:53Z")

</div>

On 12/7/06, Long [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Use \<%= if you want the output rendered.  
> No, that’s for the old-style usage; this is the new block-style usage  
> of form\_tag (see [http://www.loudthinking.com/arc/000601.html](http://www.loudthinking.com/arc/000601.html) ). Not  
> only does \<%= not help, it actually generates a Rails error.

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 9:38pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/4 "2006-12-07T21:38:58Z")

</div>

Well, as is so often the case, by finally giving up and posting to a  
public list, within minutes I was able to finally figure out what was  
wrong.

I was tripped up by the fact that the 1.2 RC1 is still numbered as a  
1.1.6 branch (1.1.6.5618 at the moment), and I had NOT installed Rails  
from [gems.rubyonrails.org](http://gems.rubyonrails.org). Thought I had. Duh.

If I weren’t so happy to have this working now, I’d be embarrassed. 🙂  
Move along, nothing to see here. 🙂

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 9:48pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/5 "2006-12-07T21:48:59Z")

</div>

Ryan W. wrote:

> > Use \<%= if you want the output rendered.
> 
> No, that’s for the old-style usage; this is the new block-style usage  
> of form\_tag (see [http://www.loudthinking.com/arc/000601.html](http://www.loudthinking.com/arc/000601.html) ). Not  
> only does \<%= not help, it actually generates a Rails error.

My bad. So is this what is new in 1.2?

Regardless of version, are there advantages to using the form\_tag…  
construct  
instead of plain HTML (e.g. \<form …\>…)?

Long  
www.edgesoft.ca/blog/read/2

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [December 7, 2006, 10:11pm UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/6 "2006-12-07T22:11:08Z")

</div>

On 12/7/06, Long [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ryan W. wrote:  
> [snip]
> 
> > No, that’s for the old-style usage; this is the new block-style usage  
> > of form\_tag (see [http://www.loudthinking.com/arc/000601.html](http://www.loudthinking.com/arc/000601.html) ). Not

> My bad. So is this what is new in 1.2?

This is one of several things coming in 1.2. You can find much more  
at [Ruby on Rails — Rails 1.2 RC1: New in ActiveRecord](http://weblog.rubyonrails.org/2006/11/26/1-2-new-in-activerecord)  
and  
[Ruby on Rails — Rails 1.2: Release Candidate 1](http://weblog.rubyonrails.org/2006/11/23/rails-1-2-release-candidate-1)  
and all over the place.

> Regardless of version, are there advantages to using the form\_tag… construct  
> instead of plain HTML (e.g. \<form …\>…)?

Well, one notable advantage is that you can let Rails properly build  
the URL to which you want to POST your form by indicating the  
controller and action and other such things by symbol or by name. I  
would hate to have to build those things manually everywhere. \<%  
form\_tag :controller=\>‘notes’, :action=\>‘list’, :id=@user do %\>…\<%  
end %\> is so much easier.

There are lots of reasons that form\_tag is your friend. You just have  
to match up the version of it that you’re using with the version of  
Rails that you actually installed on your server. 🙂

---

<div class="post-metadata">

**Author:** ![jimmyether](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@jimmyether](https://www.ruby-forum.com/u/jimmyether)\
**Post date:** [February 20, 2007, 2:46am UTC](https://www.ruby-forum.com/t/form-tag-not-producing-output/78684/7 "2007-02-20T02:46:05Z")

</div>

Ryan W. wrote:

> Well, as is so often the case, by finally giving up and posting to a  
> public list, within minutes I was able to finally figure out what was  
> wrong.
> 
> I was tripped up by the fact that the 1.2 RC1 is still numbered as a  
> 1.1.6 branch (1.1.6.5618 at the moment), and I had NOT installed Rails  
> from [gems.rubyonrails.org](http://gems.rubyonrails.org). Thought I had. Duh.
> 
> If I weren’t so happy to have this working now, I’d be embarrassed. 🙂  
> Move along, nothing to see here. 🙂

Hi,

I’m glad you found a solution for yourself. Sadly, for me,I’m  
experiencing the same problem, (no output from form\_tag).

I’ve upgraded to rails 1.2.2 via gem update on OSX in this manner:

sudo gem update rails --include-dependencies --source  
[gems.rubyonrails.org](http://gems.rubyonrails.org)  
Password:  
Updating installed gems…  
Bulk updating Gem source index for: [http://gems.rubyonrails.org](http://gems.rubyonrails.org)  
Attempting remote update of rails  
Successfully installed rails-1.2.2  
Gems: [rails] updated

My code:

\<% form\_tag( {:action=\>‘create’}, :multipart=\>true ) do %\>  
…stuff…  
\<% end %\>

All the ‘stuff’ is nowhere to be found.

Any ideas?
