Form actions with additional parameters

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

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!

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

Hi Daniel,

Thx for the tip, we’re almost getting there :slight_smile: 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 :slight_smile:

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 :slight_smile:

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

<%= start_form_tag :action => ‘create’, :create_webca => true %>

Thx for your patience :slight_smile:

cheers
Martin

Me again :slight_smile:

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 :slight_smile: Now I’m actually
wondering if it wasn’t about the back button in the beginning. ???

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 :frowning:

start_form_tag :url => { :action => ‘create’, :next_step => true }