Forcing Views

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

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.

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:

Didn't test it, but:

<% form_tag( {:action=>'create'}, { :multipart=>true, :onSubmit=>(stuff)
} ) do %>

?