# Forms without the helpers

**URL:** <https://www.ruby-forum.com/t/forms-without-the-helpers/103314>\
**Category:** Rails\
**Created:** [May 4, 2007, 4:05am UTC](https://www.ruby-forum.com/t/forms-without-the-helpers/103314 "2007-05-04T04:05:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [May 4, 2007, 4:05am UTC](https://www.ruby-forum.com/t/forms-without-the-helpers/103314/1 "2007-05-04T04:05:28Z")

</div>

Hi there!

I’m a bit of a rails newbie, and I’ve had success as long as I followed  
rails conventions and used the form helpers. But now I want to do  
something a little different and I’m already stumped. I want to pass  
some form data into the controller, but it’s not related to a database  
model or anything like that. Here’s what I have in my view:

\<%= start\_form\_tag :action =\> ‘testing’ %\>  
  
\<%= submit\_tag “Create” %\>  
\<%= end\_form\_tag %\>

I guess I’m not sure how to access the form data named “foo” in the  
controller. Is it something sort of like this:

def testing(foo)  
@bar = foo  
end

Thanks for the help in advanced. I’m guessing this is pretty simple, but  
I’m new to ruby, rails, and programming in general.

Dave

---

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [May 4, 2007, 4:10am UTC](https://www.ruby-forum.com/t/forms-without-the-helpers/103314/2 "2007-05-04T04:10:31Z")

</div>

Here’s what belongs in your controller:  
def testing  
@bar = params[:foo]  
end

You should change your view not to user  
start\_form\_tag…end\_form\_tag, it’s deprecated. Here’s how instead:  
\<% form\_tag :action=\> ‘testing’ do %\>  
…  
\<% end %\>  
Notice those are in \<% %\>, not \<%= %\>.  
Andy

---

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [May 4, 2007, 4:12am UTC](https://www.ruby-forum.com/t/forms-without-the-helpers/103314/3 "2007-05-04T04:12:31Z")

</div>

On 5/4/07, Dave A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<%= start\_form\_tag :action =\> ‘testing’ %\>
> 
> Thanks for the help in advanced. I’m guessing this is pretty simple, but  
> I’m new to ruby, rails, and programming in general.
> 
> Dave

To get access to parameters you need to use the params method

def testing  
@bar = param[:foo]  
end

Cheers

---

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [May 4, 2007, 4:20am UTC](https://www.ruby-forum.com/t/forms-without-the-helpers/103314/4 "2007-05-04T04:20:31Z")

</div>

> def testing  
> @bar = param[:foo]  
> end

Thanks to both of you! Worked perfectly.
