Stumped, the ajax submit works but does not pass the file param for
some reason.
<iframe name="upload_file" id="upload_file" style="width:1px;height:
1px;border:0px"></iframe>
<% fields_for :file, :html => { :multipart =>
true, :target=>"upload_file" } do %>
<b>Picture:</b>
<%= file_field_tag :upload %>
<%= submit_to_remote 'up',"Upload", :method=>'post',
:url =>
{ :controller => "rfi", :action => "sendfile", :id =>
@rfi }, :target=>"upload_file" %>
<% end %>
On Jul 26, 10:56 pm, Chris Habgood <[email protected]> wrote:
> Ok, I changed to this but it is posting normally and not ajax for some
> reason. i see in the source that it is supposed to do an ajax submit.
> <% form_remote_tag(:url => { :controller => "image_demo", :action =>
> "create" }, :html => {:multipart => true}) do %>
> <b>Picture:</b>
> <%= file_field_tag "asset" %>
> <%= submit_tag "Upload" %>
> <% end %>
>
> On Sun, Jul 26, 2009 at 10:52 PM, Frederick Cheung <
>
>
>
> [email protected]> wrote:
>
> > On Jul 27, 4:21 am, Me <[email protected]> wrote:
> > > I have this basic code in place and it is giving me an:
> > > "undefined local variable or method `end_form_tag' for
> > > #<ActionView::Base:0x41a2094>"
>
> > Because end_form_tag was removed from rails 2.0
>
> > Fred
> > > Note sure why I am getting the error as it is straight from:
> >http://railsblaster.wordpress.com/2007/09/20/ajax-forms-and-file-uplo...
>
> > > view:
>
> > > <%= form_remote_tag(:url => { :controller => "image_demo", :action =>
> > > "create" }, :html => {:multipart => true}) %>
> > > <b>Picture:</b>
> > > <%= file_field_tag "asset" %>
> > > <%= submit_tag "Upload" %>
> > > <%= end_form_tag %>
>
> > > remote_uploads.rb in lib directory:
>
> > > module ActionView
> > > module Helpers
> > > module PrototypeHelper
> > > #alias_method :form_remote_tag_old, :form_remote_tag
> > > def form_remote_tag(options = {}, &block)
> > > unless options[:html] && options[:html][:multipart]
> > > form_remote_tag_old(options, &block)
> > > else
> > > uid = "a#{Time.now.to_f.hash}"
> > > <<-STR
> > > enctype="multipart/form-data"
> > target="#{uid}" #{%(onsubmit="#
> > > {options[:loading]}") if options[:loading]}
>
> > > STR
>
> > > end
> > > end
> > > end
> > > end
> > > end
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---