This project is archived and is in readonly mode.

#2161 ✓resolved
Keith Pitt

Loosing field contents when positioned after file upload

Reported by Keith Pitt | March 7th, 2009 @ 01:49 AM

I have a form that contains a file upload and a 2 text fields.


<li><%= t.file_field :artwork %></li>
<li><%= t.text_field :caption %></li>
<li><%= t.text_field :tags %></li>

When I submit the form with a file upload, and filling in the 2 other fields, the "caption" field drops from the posted fields.


Processing Admin::Campaigns::AdvertisementsController#create (for 127.0.0.1 at 2009-03-07 12:14:14) [POST]
  Parameters: {"campaign_advertisement"=>{"artwork"=>#<File:/var/folders/PD/PDwtDVH6G1qCmfQOwD-Og++++TI/-Tmp-/RackMultipart.15675.0>}, "tags" => "foo bar", "commit"=>"post", "campaign_id"=>"1", "authenticity_token"=>"Y0gwv6Ev9DdH4mgLAN86y+W+rMQOR2GsMoSqHKCdqoE="}

But if I submit the form without the file upload, the "caption" field comes through.


Processing Admin::Campaigns::AdvertisementsController#create (for 127.0.0.1 at 2009-03-07 12:17:37) [POST]
  Parameters: {"campaign_advertisement"=>{"artwork"=>nil, "caption"=>"asdfasdfasdf", "tags" => "foo bar"}, "commit"=>"post", "campaign_id"=>"1", "authenticity_token"=>"Y0gwv6Ev9DdH4mgLAN86y+W+rMQOR2GsMoSqHKCdqoE="}

I have no tricky javascript going on that would cause something like this. I'm running rails 2.3.0 rc1. I have tried rc2 but couldn't even get that working. (params wherent working, i.e. name="member[userame]" wasnt being turned into { :members =>{ :username => 'foo' }}.

I also noticed that If I switch the position of "tags" and "caption" around, so it reads:


<li><%= t.file_field :artwork %></li>
<li><%= t.text_field :tags %></li>
<li><%= t.text_field :caption %></li>

"tags" is now dropped from the posted fields. It would seem any field directly after the file upload is being dropped from post.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages