Hi guys, I''m using attachment_fu to upload large files, and when the user presses submit on the form action/view and calls the "create" action, it uploads the file, and then redirects the user to an index action/view. However, b/c of the size of the file and the time it takes to upload, I would like to show the actual view for "create", having it say something like "please be patient while your file uploads". While I have simply tried making a view for my "create" action, it does not work. After pressing submit on the form view, it simply stalls on that page while the file is being uploaded and then automatically issues the redirect at the end of my create action, without ever showing me the view for create. How would I force the app to actually show the view that goes along w/ create, while the file is being uploaded and before the redirect? A very simplified version of the code: controller: [code=] def form @post = Post.new end def create @post = Post.new(params[:post]) if @post.save redirect_to :action => ''index'' end end[/code] The form view: [code=]<% form_tag ({:action => ''create''}, :multipart => true) do %> <%= file_field_tag ''post'', :size => 50 -%> <%= submit_tag ''Submit'' %> <%end%>[/code] Thanks in advance for the help everyone. -shoma -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
One strategy would be to use javascript to show a new div with that message just before the form is submitted, so that the user sees that div while waiting for the response. On Aug 28, 1:03 am, Shoma Nishikawa <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi guys, > > I''m using attachment_fu to upload large files, and when the user presses > submit on the form action/view and calls the "create" action, it > uploads the file, and then redirects the user to an index action/view. > > However, b/c of the size of the file and the time it takes to upload, I > would like to show the actual view for "create", having it say something > like "please be patient while your file uploads". > > While I have simply tried making a view for my "create" action, it does > not work. After pressing submit on the form view, it simply stalls on > that page while the file is being uploaded and then automatically issues > the redirect at the end of my create action, without ever showing me the > view for create. > > How would I force the app to actually show the view that goes along w/ > create, while the file is being uploaded and before the redirect? > > A very simplified version of the code: > > controller: > [code=] > def form > @post = Post.new > end > > def create > @post = Post.new(params[:post]) > if @post.save > redirect_to :action => ''index'' > end > end[/code] > The form view: > [code=]<% form_tag ({:action => ''create''}, :multipart => true) do %> > <%= file_field_tag ''post'', :size => 50 -%> > <%= submit_tag ''Submit'' %> > <%end%>[/code] > Thanks in advance for the help everyone. > > -shoma > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks JDevine. I have tried your method, and have implemented the following lines but to no avail. These all change the way I begin my form: <% form_tag ({:action => ''create''}, :multipart => true, :html => {:onSubmit => "$(hidden).show"}) do %> <% form_tag ({:action => ''create''}, :multipart => true, :onSubmit => "$(''hidden'').show") do %> <% form_tag ({:action => ''create''}, :multipart => true, :onSubmit => "$(hidden).show") do %> I then have a div w/ an id of "hidden" that contains text, but hitting submit does not have an effect on the div. Thanks in advance for all the help. I really appreciate it. -Shoma JDevine wrote:> One strategy would be to use javascript to show a new div with that > message > just before the form is submitted, so that the user sees that div > while waiting for the > response. > > On Aug 28, 1:03�am, Shoma Nishikawa <rails-mailing-l...@andreas-s.net>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Didn''t test it, but: <% form_tag( {:action=>''create''}, { :multipart=>true, :onSubmit=>(stuff) } ) do %> ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---