I have the file upload working, I have to place it outside my main form. Is there a way so I can have somewhere other than outside my form? This below is all after the submit button: <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => { :files => @files } %> </div> <iframe name="upload_file" id="upload_file" style="width:1px;height: 1px;border:0px"></iframe> <% form_for :file, :url => file_upload_path(:format => ''js''), :html => { :multipart => true, :target => ''upload_file'' } do %> <b>File:</b> <%= file_field_tag :upload %> <%= hidden_field_tag ''rfi'', @rfi.id %> <%= submit_tag ''Upload File'' %> <% end %>
anyone? On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have thefileupload working, I have to place it outside my main > form. > > Is there a way so I can have somewhere other than outside my form? > > This below is all after the submit button: > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => > { :files => @files } %> </div> > > <iframe name="upload_file" id="upload_file" style="width:1px;height: > 1px;border:0px"></iframe> > <% form_for :file, :url => file_upload_path(:format => ''js''), :html => > { :multipart => true, :target => ''upload_file'' } do %> > <b>File:</b> > <%= file_field_tag :upload %> > <%= hidden_field_tag ''rfi'', @rfi.id %> > <%= submit_tag ''UploadFile'' %> > <% end %>
why do you need it outside the main form? is the main form also going to be there on that page? you might want to check out form_tag http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 good luck! On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> anyone? > > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have thefileupload working, I have to place it outside my main > > form. > > > Is there a way so I can have somewhere other than outside my form? > > > This below is all after the submit button: > > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => > > { :files => @files } %> </div> > > > <iframe name="upload_file" id="upload_file" style="width:1px;height: > > 1px;border:0px"></iframe> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html => > > { :multipart => true, :target => ''upload_file'' } do %> > > <b>File:</b> > > <%= file_field_tag :upload %> > > <%= hidden_field_tag ''rfi'', @rfi.id %> > > <%= submit_tag ''UploadFile'' %> > > <% end %>
Well the file upload was not working because it is a form inside a form. On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > why do you need it outside the main form? is the main form also going > to be there on that page? > you might want to check out form_tag > > http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 > > good luck! > > On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > anyone? > > > > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have thefileupload working, I have to place it outside my main > > > form. > > > > > Is there a way so I can have somewhere other than outside my form? > > > > > This below is all after the submit button: > > > > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => > > > { :files => @files } %> </div> > > > > > <iframe name="upload_file" id="upload_file" style="width:1px;height: > > > 1px;border:0px"></iframe> > > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html => > > > { :multipart => true, :target => ''upload_file'' } do %> > > > <b>File:</b> > > > <%= file_field_tag :upload %> > > > <%= hidden_field_tag ''rfi'', @rfi.id %> > > > <%= submit_tag ''UploadFile'' %> > > > <% 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 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 -~----------~----~----~----~------~----~------~--~---
Can you be more descriptive? If the file is related to the model who''s form is on the page, then the file can and should be a part of the form for that model. If the file is unrelated to the model who''s form is in the page and/or you want to include a separate form for the file upload, then you can use something like <% form_tag :file, :url => file_upload_path(:format => ''js''), :html => { :multipart => true, :target => ''upload_file'' } do %> <b>File:</b> <%= file_field_tag :upload %> <%= hidden_field_tag ''rfi'', @rfi.id %> <%= submit_tag ''UploadFile'' %> <% end %> ... which is just the code u pasted with form_tag instead of form_for. you should read the API to understand the difference. 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> Well the file upload was not working because it is a form inside a form. > > On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> why do you need it outside the main form? is the main form also going >> to be there on that page? >> you might want to check out form_tag >> >> http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 >> >> good luck! >> >> On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > anyone? >> > >> > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > >> > > I have thefileupload working, I have to place it outside my main >> > > form. >> > >> > > Is there a way so I can have somewhere other than outside my form? >> > >> > > This below is all after the submit button: >> > >> > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => >> > > { :files => @files } %> </div> >> > >> > > <iframe name="upload_file" id="upload_file" style="width:1px;height: >> > > 1px;border:0px"></iframe> >> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html => >> > > { :multipart => true, :target => ''upload_file'' } do %> >> > > <b>File:</b> >> > > <%= file_field_tag :upload %> >> > > <%= hidden_field_tag ''rfi'', @rfi.id %> >> > > <%= submit_tag ''UploadFile'' %> >> > > <% end %> >> >> > > > >-- In Sport We Trust !!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I do know the difference but when I move the code into the main form it tries to submit the whole form. On Sun, Aug 9, 2009 at 11:59 PM, Vinay Seshadri <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Can you be more descriptive? > If the file is related to the model who''s form is on the page, then the > file can and should be a part of the form for that model. > > If the file is unrelated to the model who''s form is in the page and/or you > want to include a separate form for the file upload, then you can use > something like > > <% form_tag :file, :url => file_upload_path(:format => ''js''), :html => > { :multipart => true, :target => ''upload_file'' } do %> > <b>File:</b> > <%= file_field_tag :upload %> > <%= hidden_field_tag ''rfi'', @rfi.id %> > <%= submit_tag ''UploadFile'' %> > <% end %> > > ... which is just the code u pasted with form_tag instead of form_for. you > should read the API to understand the difference. > > 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > Well the file upload was not working because it is a form inside a form. >> >> On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> >>> why do you need it outside the main form? is the main form also going >>> to be there on that page? >>> you might want to check out form_tag >>> >>> http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 >>> >>> good luck! >>> >>> On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > anyone? >>> > >>> > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > >>> > > I have thefileupload working, I have to place it outside my main >>> > > form. >>> > >>> > > Is there a way so I can have somewhere other than outside my form? >>> > >>> > > This below is all after the submit button: >>> > >>> > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => >>> > > { :files => @files } %> </div> >>> > >>> > > <iframe name="upload_file" id="upload_file" style="width:1px;height: >>> > > 1px;border:0px"></iframe> >>> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html >>> => >>> > > { :multipart => true, :target => ''upload_file'' } do %> >>> > > <b>File:</b> >>> > > <%= file_field_tag :upload %> >>> > > <%= hidden_field_tag ''rfi'', @rfi.id %> >>> > > <%= submit_tag ''UploadFile'' %> >>> > > <% end %> >>> >>> >> >> >> > > > -- > In Sport We Trust !!! > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can use either form_for or form_tag for the file. In either case, the main form should close before you start the one for the file. Whats the problem? 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> I do know the difference but when I move the code into the main form it > tries to submit the whole form. > > On Sun, Aug 9, 2009 at 11:59 PM, Vinay Seshadri < > yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Can you be more descriptive? >> If the file is related to the model who''s form is on the page, then the >> file can and should be a part of the form for that model. >> >> If the file is unrelated to the model who''s form is in the page and/or you >> want to include a separate form for the file upload, then you can use >> something like >> >> <% form_tag :file, :url => file_upload_path(:format => ''js''), :html => >> { :multipart => true, :target => ''upload_file'' } do %> >> <b>File:</b> >> <%= file_field_tag :upload %> >> <%= hidden_field_tag ''rfi'', @rfi.id %> >> <%= submit_tag ''UploadFile'' %> >> <% end %> >> >> ... which is just the code u pasted with form_tag instead of form_for. you >> should read the API to understand the difference. >> >> 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >> Well the file upload was not working because it is a form inside a form. >>> >>> On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>>> >>>> why do you need it outside the main form? is the main form also going >>>> to be there on that page? >>>> you might want to check out form_tag >>>> >>>> http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 >>>> >>>> good luck! >>>> >>>> On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> > anyone? >>>> > >>>> > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> > >>>> > > I have thefileupload working, I have to place it outside my main >>>> > > form. >>>> > >>>> > > Is there a way so I can have somewhere other than outside my form? >>>> > >>>> > > This below is all after the submit button: >>>> > >>>> > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => >>>> > > { :files => @files } %> </div> >>>> > >>>> > > <iframe name="upload_file" id="upload_file" style="width:1px;height: >>>> > > 1px;border:0px"></iframe> >>>> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html >>>> => >>>> > > { :multipart => true, :target => ''upload_file'' } do %> >>>> > > <b>File:</b> >>>> > > <%= file_field_tag :upload %> >>>> > > <%= hidden_field_tag ''rfi'', @rfi.id %> >>>> > > <%= submit_tag ''UploadFile'' %> >>>> > > <% end %> >>>> >>>> >>> >>> >>> >> >> >> -- >> In Sport We Trust !!! >> >> >> > > > >-- In Sport We Trust !!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well all file uploads from what I have seen are within the main form not below the submit button. I guess I will just use a modal box to do the uploads. On Mon, Aug 10, 2009 at 11:07 PM, Vinay Seshadri <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You can use either form_for or form_tag for the file. In either case, the > main form should close before you start the one for the file. > Whats the problem? > > > 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> I do know the difference but when I move the code into the main form it >> tries to submit the whole form. >> >> On Sun, Aug 9, 2009 at 11:59 PM, Vinay Seshadri < >> yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Can you be more descriptive? >>> If the file is related to the model who''s form is on the page, then the >>> file can and should be a part of the form for that model. >>> >>> If the file is unrelated to the model who''s form is in the page and/or >>> you want to include a separate form for the file upload, then you can use >>> something like >>> >>> <% form_tag :file, :url => file_upload_path(:format => ''js''), :html => >>> { :multipart => true, :target => ''upload_file'' } do %> >>> <b>File:</b> >>> <%= file_field_tag :upload %> >>> <%= hidden_field_tag ''rfi'', @rfi.id %> >>> <%= submit_tag ''UploadFile'' %> >>> <% end %> >>> >>> ... which is just the code u pasted with form_tag instead of form_for. >>> you should read the API to understand the difference. >>> >>> 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> >>> Well the file upload was not working because it is a form inside a form. >>>> >>>> On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >>>> >>>>> >>>>> why do you need it outside the main form? is the main form also going >>>>> to be there on that page? >>>>> you might want to check out form_tag >>>>> >>>>> http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 >>>>> >>>>> good luck! >>>>> >>>>> On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>> > anyone? >>>>> > >>>>> > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>> > >>>>> > > I have thefileupload working, I have to place it outside my main >>>>> > > form. >>>>> > >>>>> > > Is there a way so I can have somewhere other than outside my form? >>>>> > >>>>> > > This below is all after the submit button: >>>>> > >>>>> > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => >>>>> > > { :files => @files } %> </div> >>>>> > >>>>> > > <iframe name="upload_file" id="upload_file" >>>>> style="width:1px;height: >>>>> > > 1px;border:0px"></iframe> >>>>> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html >>>>> => >>>>> > > { :multipart => true, :target => ''upload_file'' } do %> >>>>> > > <b>File:</b> >>>>> > > <%= file_field_tag :upload %> >>>>> > > <%= hidden_field_tag ''rfi'', @rfi.id %> >>>>> > > <%= submit_tag ''UploadFile'' %> >>>>> > > <% end %> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> -- >>> In Sport We Trust !!! >>> >>> >>> >> >> >> > > > -- > In Sport We Trust !!! > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have a Paperclip file upload going inside my model''s form, but not in a form for itself. I was approaching this as a form issue. Anyway, you should try Paperclip if it seems like it might help you. Its really extremely easy file uploads. www.thoughtbot.com/projects/paperclip good luck! 2009/8/11 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > Well all file uploads from what I have seen are within the main form not below the submit button. I guess I will just use a modal box to do the uploads. > > On Mon, Aug 10, 2009 at 11:07 PM, Vinay Seshadri <yourstruly.vinay@gmail.com> wrote: >> >> You can use either form_for or form_tag for the file. In either case, the main form should close before you start the one for the file. >> Whats the problem? >> >> 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> >>> I do know the difference but when I move the code into the main form it tries to submit the whole form. >>> >>> On Sun, Aug 9, 2009 at 11:59 PM, Vinay Seshadri <yourstruly.vinay@gmail.com> wrote: >>>> >>>> Can you be more descriptive? >>>> If the file is related to the model who''s form is on the page, then the file can and should be a part of the form for that model. >>>> If the file is unrelated to the model who''s form is in the page and/or you want to include a separate form for the file upload, then you can use something like >>>> <% form_tag :file, :url => file_upload_path(:format => ''js''), :html => >>>> { :multipart => true, :target => ''upload_file'' } do %> >>>> <b>File:</b> >>>> <%= file_field_tag :upload %> >>>> <%= hidden_field_tag ''rfi'', @rfi.id %> >>>> <%= submit_tag ''UploadFile'' %> >>>> <% end %> >>>> ... which is just the code u pasted with form_tag instead of form_for. you should read the API to understand the difference. >>>> >>>> 2009/8/10 Chris Habgood <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>>>> >>>>> Well the file upload was not working because it is a form inside a form. >>>>> >>>>> On Sun, Aug 9, 2009 at 11:46 PM, Ram <yourstruly.vinay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>> >>>>>> why do you need it outside the main form? is the main form also going >>>>>> to be there on that page? >>>>>> you might want to check out form_tag >>>>>> http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001729 >>>>>> >>>>>> good luck! >>>>>> >>>>>> On Aug 8, 9:58 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>> > anyone? >>>>>> > >>>>>> > On Aug 7, 3:55 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>> > >>>>>> > > I have thefileupload working, I have to place it outside my main >>>>>> > > form. >>>>>> > >>>>>> > > Is there a way so I can have somewhere other than outside my form? >>>>>> > >>>>>> > > This below is all after the submit button: >>>>>> > >>>>>> > > <div id="file"> <%= render :partial => ''/rsl/sitelist'', :locals => >>>>>> > > { :files => @files } %> </div> >>>>>> > >>>>>> > > <iframe name="upload_file" id="upload_file" style="width:1px;height: >>>>>> > > 1px;border:0px"></iframe> >>>>>> > > <% form_for :file, :url => file_upload_path(:format => ''js''), :html => >>>>>> > > { :multipart => true, :target => ''upload_file'' } do %> >>>>>> > > <b>File:</b> >>>>>> > > <%= file_field_tag :upload %> >>>>>> > > <%= hidden_field_tag ''rfi'', @rfi.id %> >>>>>> > > <%= submit_tag ''UploadFile'' %> >>>>>> > > <% end %> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> In Sport We Trust !!! >>>> >>>> >>> >>> >>> >> >> >> >> -- >> In Sport We Trust !!! >> >> > > > >-- In Sport We Trust !!!