Forum: Ruby on Rails Form actions with additional parameters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Martin G. (Guest)
on 2006-05-18 05:35
(Received via mailing list)

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?

Daniel H. (Guest)
on 2006-05-18 05:47
(Received via mailing list)
Howdy Martin,

The first argument of start_form_tag can be a hash of options for
try something like

<%= start_form_tag {:action => 'create', :id=whatever,
:param3="community_farm"}, next_step => true %>

I hope this helps!
Martin G. (Guest)
on 2006-05-18 06:48
(Received via mailing list)
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!
Daniel -. (Guest)
on 2006-05-18 06:54
(Received via mailing list)
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
here :(

start_form_tag :url => { :action => 'create', :next_step => true }
Martin G. (Guest)
on 2006-05-18 07:04
(Received via mailing list)
Hi Daniel,

Thx for the tip, we're almost getting there :-) Your proposed
statement leads to the following html output:

<form action="/admin/community/new?url=next_steptrueactioncreate"

close but not quite there, if only it weren't so late already where I
live :)
Martin G. (Guest)
on 2006-05-18 07:13
(Received via mailing list)
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 :)

Martin G. (Guest)
on 2006-05-18 07:19
(Received via mailing list)
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. ???
This topic is locked and can not be replied to.