# form\_tag code block

**URL:** <https://discuss.rubyonrails.org/t/form-tag-code-block/8857>\
**Category:** rubyonrails-talk\
**Created:** [February 16, 2007, 9:12pm UTC](https://discuss.rubyonrails.org/t/form-tag-code-block/8857 "2007-02-16T21:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julian4](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@julian4](https://discuss.rubyonrails.org/u/julian4)\
**Post date:** [February 16, 2007, 9:12pm UTC](https://discuss.rubyonrails.org/t/form-tag-code-block/8857/1 "2007-02-16T21:12:31Z")

</div>

I have this in a template-\>

Hello \<% form\_tag :action =\> "create" do %\> My pretty form! \<% end %\>

And all I'm getting at output is -\>

Hello

Actually, any actionview helper that is supposed to take a code block is not working for me. What wicked stupid thing am I missing here?

---

<div class="post-metadata">

**Author:** ![julian4](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@julian4](https://discuss.rubyonrails.org/u/julian4)\
**Post date:** [February 16, 2007, 9:28pm UTC](https://discuss.rubyonrails.org/t/form-tag-code-block/8857/2 "2007-02-16T21:28:45Z")

</div>

Thanks for the reply!

Sadly, though, I tried that.

Error-\>

compile error C:/INSTAN~1/rails\_apps/lumina\_erp/config/../app/views/bom\_lines/ edit.rhtml:2: parse error, unexpected ')' \_erbout.concat(( form\_tag :action =\> "create" do ).to\_s); \_erbout.concat "\n" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^ C:/INSTAN~1/rails\_apps/lumina\_erp/config/../app/views/bom\_lines/ edit.rhtml:5: parse error, unexpected kEND, expecting ')'

Obvioulsy from the error message you can see that this is on a M$ machine (InstantRails 1.4 WinXP).

Anyways, just tried it on Ubuntu server and it works fine. Must be a problem with InstantRails.

So to recap... The first way I posted (and that's all over api.rubyonrails.org) is correct. I'm gonna try and update activeview through gem now I guess.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Niels\_Meersschaert](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@Niels\_Meersschaert](https://discuss.rubyonrails.org/u/Niels_Meersschaert)\
**Post date:** [February 17, 2007, 1:31pm UTC](https://discuss.rubyonrails.org/t/form-tag-code-block/8857/3 "2007-02-17T13:31:23Z")

</div>

Have you tried adding form fields to the form tag? i.e.

Hello \<% form\_tag :action =\> "create" do %\> &nbsp;&nbsp;\<p\>My pretty form!\</p\> &nbsp;&nbsp;\<p\>\<%= text\_field "foo", "bar" %\>\</p\> &nbsp;&nbsp;\<p\>\<%= submit\_tag "Do it!" %\>\</p\> \<% end %\>

Also when you said it only outputted Hello was that what you saw  
rendered in the browser or was that the source of the output?

Niels
