# Form actions with additional parameters

**URL:** <https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956>\
**Category:** Rails\
**Created:** [May 18, 2006, 3:35am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956 "2006-05-18T03:35:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 3:35am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/1 "2006-05-18T03:35:26Z")

</div>

Hiall,

I want to give the action of a form an additional parameters but can’t  
figure out how to do it. My code looks like this

\<%= start\_form\_tag :action =\> ‘create’, next\_step =\> true %\>  
\<%= render :partial =\> ‘user\_form’ %\>  
\<%= render :partial =\> ‘community\_form’ %\>  
\<%= submit\_tag “Optional Next Step” %\>  
\<%= end\_form\_tag %\>

\<%= button\_to ‘Skip Next Step’, :action =\> ‘create’, next\_step =\> false  
%\>

The form\_tag should demonstrate what I intend to do. In the  
corresponding ‘create’ action of my controller, I want to redirect\_to  
different locations depending on params[:next\_step], but somehow  
params[:next\_step] is never present, and I always end up being  
redirected to the ‘Skip next Step’ action,

Any ideas?

cheers  
Martin

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 3:47am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/2 "2006-05-18T03:47:36Z")

</div>

Howdy Martin,

The first argument of start\_form\_tag can be a hash of options for  
url\_for-  
try something like

\<%= start\_form\_tag {:action =\> ‘create’, :id=whatever,  
:param3=“community\_farm”}, next\_step =\> true %\>

I hope this helps!

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 4:48am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/3 "2006-05-18T04:48:27Z")

</div>

After reading apidoc I am convinced that passing arguments for urls  
should work with form\_tag. I tried the following:

\<%= start\_form\_tag({:action =\> ‘create’}, {}, :create\_webca =\> true) %\>

and it also gives me no parameters for the url … I can’t figure out  
what I’m doing wrong

Any help VERY much appreciated!  
Martin

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 5:04am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/4 "2006-05-18T05:04:16Z")

</div>

Hi Daniel,

Thx for the tip, we’re almost getting there 🙂 Your proposed  
statement leads to the following html output:

close but not quite there, if only it weren’t so late already where I  
live 🙂

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 5:13am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/5 "2006-05-18T05:13:30Z")

</div>

Thx for the replies guys! I could swear I tried that before, maybe I  
didn’t reload properly, back button is too much a habit 🙂

This works (like Daniel suggested the key option should be a symbol)

\<%= start\_form\_tag :action =\> ‘create’, :create\_webca =\> true %\>

Thx for your patience 🙂

cheers  
Martin

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 5:19am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/6 "2006-05-18T05:19:44Z")

</div>

Me again 🙂

Funny enough, this doesn’t give me the expected parameter

\<%= button\_to ‘Skip next step’, :action =\> ‘create’, :create\_webca =\>  
false %\>

Yes, I got the one with the back button right 🙂 Now I’m actually  
wondering if it wasn’t about the back button in the beginning. ???

---

<div class="post-metadata">

**Author:** ![martin-ga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@martin-ga](https://www.ruby-forum.com/u/martin-ga)\
**Post date:** [May 18, 2006, 4:54am UTC](https://www.ruby-forum.com/t/form-actions-with-additional-parameters/94956/7 "2006-05-18T04:54:49Z")

</div>

Hi Martin.

Your inclusion of next\_step =\> true should be :next\_step =\> true

ie, the option key should be a symbol.  
The call should be made (I think) as follows. I’m at work and have no  
ruby  
here ☹

start\_form\_tag :url =\> { :action =\> ‘create’, :next\_step =\> true }
