Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3302540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:51:45+00:00 2026-05-17T20:51:45+00:00

I assume this one is rather a JavaScript/jQuery/DOM question than a Rails question, but

  • 0

I assume this one is rather a JavaScript/jQuery/DOM question than a Rails question, but it’s all due to the way I implemented it in Rails.

I am trying to upload files while creating a new object (auction). While the user inputs some data, he shall also have the possibility to upload multiple photos.

The main problem is, that the files should be uploaded while filling out the form. And the form is a tabbed one, so the photos are on tab 3 of 5 and all tabs sit within the overall create form. That means, that the upload form has to be (DOM position) within the main form for creating the object, which is not allowed by the HTML specification.

To avoid nesting forms I tried to jQuery.clone() the file field when submitting the photo first, so I can create the upload form on the fly – but this didn’t work, as JS doesn’t seem to be able to access the value of a file field.

So my question is: how could I implement such a “submit form to hidden iframe” thingy, when I can’t avoid to place the upload-only form within another form, from a DOM point of view? Does anyone know a good hint or something?

Thanks in advance for your help

Arne

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:51:45+00:00Added an answer on May 17, 2026 at 8:51 pm

    Ok, assuming you have one form, you can do the following:

    • Set the target of your form to point to the name of the Iframe. The POST with the file upload will occur in the background, targeting the Iframe.
    • Use window.setTimeout(function() {document.form1.target=''},1) to clear the target after when your form submits.
    • Continue using the form as normal.

    If course it’s a little easier if you have multiple forms, that way you can just point the file upload form to that target by itself.

    EDIT – Try this:

    <form id="upload-form" target="myiFrame"><input type="file" /></form>
    <form action="/model/create"></form>
    <iframe name="myiFrame" src="/model/upload"></iframe>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an Eclipse question, and you can assume the Java package for all
This is one of those little detail (and possibly religious) questions. Let's assume we're
I wrote this snippet of code and I assume len is tail-recursive, but a
This is a bit hypothetical and grossly simplified but... Assume a program that will
I've read a few posts on this, but there's still one thing that's not
A similar question was asked here , but the answers generally all seem to
On OS from win 2000 or later (any language) can I assume that this
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)
Assume we have a method like this: public IEnumerable<T> FirstMethod() { var entities =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.