bill-4qJMilvFZdi/7u6bA4Lga2Xnswh1EIUO@public.gmane.org
2005-Jul-25 19:58 UTC
Dynamic variables?
I am hoping someone can a newbie here with this, as I am losing my mind trying to figure this out. Here is what I am trying to do: I have a ajaxed form, where a user enters the number of secondary fields, and the page builds said number of fields and then once the users fills out those fields and hits submit it calls an action to concatinate the fields data into a string with a | seperator. I am struggling with how to take the data from this dynamic set of fields and actually build the concatinated string. Here is the views and controller code I am working with: CONTROLLER: class StepTwoController < ApplicationController def index # @labelNumber = request.raw_post._to_i end def addFields @labelNumber = request.raw_post.to_i render (:layout => false) end def buildLabels # this gets the number of labels from the orginal form @labelNumber = params[:id] end end INDEX.RHTML <h2>ADD LABELS</h2> <%= text_field_tag :labelNumber %> <%= observe_field( :labelNumber, :frequency => 0.5, :update => ''fields'', :url => { :action => :addFields }) %> <br/><br/><br/> <div id="fields"></div> ADDFIELDS.RHTML <%= start_form_tag :action => ''buildLabels'', :id => @labelNumber %> <% (1..@labelNumber).each do |i| %> <input type="text" name="field_<%= i %>" /><br/><br /> <% end %> <%= hidden_field ''label'', "labelNumb", "value" => @labelNumber %> <%= submit_tag "Continue to Step 3 >>" %> <%= end_form_tag %> The problem I am having is I dont how to get the data from addFields.html and modify it in the buildLabels action. Any help would be appritiated, as I am losing my mind on this. thanks, -bill _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails