Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5997267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:14:21+00:00 2026-05-23T00:14:21+00:00

I have the following remote form_tag, whose goal is to POST the following params:

  • 0

I have the following remote form_tag, whose goal is to POST the following params: Promotion id and bgUploaderFields to the create action of the csv_upload controller, mimicking the behavior of csv_uploads/new action, from another screen.

= form_tag csv_uploads_path(:method=> :post), :remote => true, :disable_with => 'Adding multiple...' do
  = text_field_tag "bgUploaderFieldName", "", :id => "bgUploaderField", :readonly => "true"
  = hidden_field :promotion_id, :value => @promotion.id unless @promotion.nil?
  = submit_tag 'Add multiple'

After I post, I am submitting null values:

INSERT INTO `csv_uploads` (`promotion_id`, `created_at`, `updated_at`, `bgUploaderField`) VALUES (NULL, '2011-06-08 17:32:15', '2011-06-08 17:32:15', NULL)

Here is my rake routes:

$ rake routes
(in /Users/boris/projects/test)
           csv_uploads GET    /csv_uploads(.:format)                                     {:action=>"index", :controller=>"csv_uploads"}
                       POST   /csv_uploads(.:format)                                     {:action=>"create", :controller=>"csv_uploads"}

csv_uploads_controller.rb

def create
    @csv_upload = CsvUpload.new(params[:csv_upload])

    respond_to do |format|
      if @csv_upload.save
        format.html { redirect_to(@csv_upload, :notice => 'Csv upload was successfully created.') }
        format.xml  { render :xml => @csv_upload, :status => :created, :location => @csv_upload }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @csv_upload.errors, :status => :unprocessable_entity }
      end
    end
  end

  def new
    @csv_upload = CsvUpload.new
    @promotion = Promotion.find_by_sms_promo_id(params[:promo_id])

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @csv_upload }
    end   end

What have I done wrong? I should also mention that the parmas values are in fact populated on screen.

Started POST "/csv_uploads?method=post" for 127.0.0.1 at 2011-06-08 10:56:42 -0700
  Processing by CsvUploadsController#create as JS
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"1zJCwY0sXb4TaTpO2d+MLox2CHk1sBpho/JR4oH18sw=", "bgUploaderFieldName"=>"http://upload.contextoptional.com/chag/assets/20110608172149.csv", "promotion_id"=>"{:value=>2}", "commit"=>"Add multiple", "method"=>"post"}
FbConfig:

  SQL (0.1ms)  BEGIN
  SQL (0.8ms)  describe `csv_uploads`
  AREL (0.2ms)  INSERT INTO `csv_uploads` (`promotion_id`, `created_at`, `updated_at`, `bgUploaderField`) VALUES (NULL, '2011-06-08 17:56:42', '2011-06-08 17:56:42', NULL)
  SQL (0.2ms)  COMMIT
  CsvUpload Load (0.2ms)  SELECT `csv_uploads`.* FROM `csv_uploads` ORDER BY csv_uploads.id DESC LIMIT 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:14:22+00:00Added an answer on May 23, 2026 at 12:14 am

    Look at your params:

      Parameters: {"utf8"=>"✓", "authenticity_token"=>"1zJCwY0sXb4TaTpO2d+MLox2CHk1sBpho/JR4oH18sw=", "bgUploaderFieldName"=>"http://upload.contextoptional.com/chag/assets/20110608172149.csv", "promotion_id"=>"{:value=>2}", "commit"=>"Add multiple", "method"=>"post"}
    

    You don’t have a key named :csv_upload but that’s what you’re using to set the attributes in your #create action

    You should be using form_for:

    <%= form_for @csv_upload, :remote => true do |f| %>
    
      <%= f.text_field :bgUploaderFieldName %>
    
      ...
    
    <% end %>
    

    or… at the very least, you should give the tags their proper name:

    = form_tag csv_uploads_path(:method=> :post), :remote => true, :disable_with => 'Adding multiple...' do
      = text_field :csv_upload, "bgUploaderFieldName", "", :id => "bgUploaderField", :readonly => "true"
      = hidden_field :csv_upload, :promotion_id, :value => @promotion.id unless @promotion.nil?
      = submit_tag 'Add multiple'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Rails 3, suppose I have the following code: Controller ... format.js # create.js.erb
I have a form of following structure ROR code form_tag class='remote_form' remote=>true { some
Environment: Rails 3.0.4 and Ruby 1.9.2 I have the following form: <%= form_tag( {:action
I have the following problem: I have to run commands on remote servers from
I have the following problem deploying my application. It uses JMS and a remote
I have extracted the following code from selenium IDE.(c# remote control) using System; using
I have a form with the following: <% form_remote_tag :url => {:action => :wotsit}
In my Rails 3 application I have the following form: <%= form_tag(/lounge/add_new_message, :id =>
I have code like the following ( it's a remote form ) def something
I have the following code that loads element from a remote page (under same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.