hey i am using attachment_fu for photo purposes and i am trying to pass a hidden value to be stored when a photo is uploaded. i am not sure how to pass this value. this is my intuitive attempt, but its not working: <% form_for(:photo, :url => photos_path, :html => { :multipart => true }) do |f| -%> <%= f.file_field :uploaded_data, :other => params[:id] %><br/> <%= f.hidden_field :other => params[:id] %><br/> <%= submit_tag ''Create'' %> <% end -%> as you can see, i want to be able to store the value in the id params hash into the database column other. any ideas how to do this? thanks, dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<% form_for(:photo, :url => photos_path, :html => { :multipart => true }) do |f| -%> <%= f.file_field :uploaded_data%><br/> <%= f.hidden_field :other, :value=> params[:id] %><br/> <%= submit_tag ''Create'' %> <% end -%> assuming the request parameter "id" is what you want to go into the "other" field. Though it would make more sense either to populate that other field in the controller on create or in the controller method that sets up and renders the form like so: def new @photo = Photo.build(:other=>"whatever I want other to be") end then in the form, just <% form_for(:photo, :url => photos_path, :html => { :multipart => true }) do |f| -%> <%= f.file_field :uploaded_data%><br/> <%= f.hidden_field :other %><br/> <%= submit_tag ''Create'' %> <% end -%> On May 27, 6:39 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hey i am using attachment_fu for photo purposes and i am trying to > pass a hidden value to be stored when a photo is uploaded. i am not > sure how to pass this value. this is my intuitive attempt, but its > not working: > > <% form_for(:photo, :url => photos_path, :html => { :multipart => > true }) do |f| -%> > > <%= f.file_field :uploaded_data, :other => params[:id] %><br/> > <%= f.hidden_field :other => params[:id] %><br/> > > <%= submit_tag ''Create'' %> > > <% end -%> > > as you can see, i want to be able to store the value in the id params > hash into the database column other. any ideas how to do this? > thanks, dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sweet, works great. thanks. On May 27, 4:51 pm, JDevine <johnjdev...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <% form_for(:photo, :url => photos_path, :html => { :multipart => > true }) do |f| -%> > <%= f.file_field :uploaded_data%><br/> > <%= f.hidden_field :other, :value=> params[:id] %><br/> > <%= submit_tag ''Create'' %> > <% end -%> > > assuming the request parameter "id" is what you want to go into the > "other" field. > > Though it would make more sense either to populate that other field in > the controller > on create or in the controller method that sets up and renders the > form like so: > > def new > @photo = Photo.build(:other=>"whatever I want other to be") > end > > then in the form, just > > <% form_for(:photo, :url => photos_path, :html => { :multipart => > true }) do |f| -%> > <%= f.file_field :uploaded_data%><br/> > <%= f.hidden_field :other %><br/> > <%= submit_tag ''Create'' %> > <% end -%> > > On May 27, 6:39 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > hey i am using attachment_fu for photo purposes and i am trying to > > pass a hidden value to be stored when a photo is uploaded. i am not > > sure how to pass this value. this is my intuitive attempt, but its > > not working: > > > <% form_for(:photo, :url => photos_path, :html => { :multipart => > > true }) do |f| -%> > > > <%= f.file_field :uploaded_data, :other => params[:id] %><br/> > > <%= f.hidden_field :other => params[:id] %><br/> > > > <%= submit_tag ''Create'' %> > > > <% end -%> > > > as you can see, i want to be able to store the value in the id params > > hash into the database column other. any ideas how to do this? > > thanks, dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---