Hi all I’m new to rails an i’m trying to build a step by step form /
process to gather data. For example:
form one:
User enters a 8 digit number
the submit button points to form 2.
form two:
the 8 digit number from form one becomes a hidden field in form 2.
The problem I have is that the entire hash from form 1 is showing up in
form two rather than just the input data.
example:
form 1:
Step 1
<%= start_form_tag :action => ‘step2’ %>
<%= render :partial => ‘form1’ %>
<%= submit_tag “Register Tag” %>
<%= end_form_tag %>
Here is the partial (form1):
<%= text_field 'tag', 'tag' %>
CONTROLLER:
def step1
@tag = Tag.new
render :action => ‘step1’
end
def step2
@newtag = (@params[:tag])
@tag = Tag.new
render :action => ‘step2’
end
FORM 2:
…
RESULT:
If I submit 12345678 in form 1
I get “tag12345678” in form 2
FORM 2:
Source after Form 1 submit
I only want the digits 12345678.