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

  • SEARCH
  • Home
  • 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 9254963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:36:14+00:00 2026-06-18T11:36:14+00:00

i have a iframe and form like this : <iframe id=FileUploadFrame name=FileUploadFrame src= style=display:

  • 0

i have a iframe and form like this :

<iframe id="FileUploadFrame" name="FileUploadFrame" src="" style="display: none; border: 0; width: 0; height: 0;">
            <form id="FileUploadForm" name="FileUploadForm" accept-charset="utf-8"  target="FileUploadFrame" enctype="multipart/form-data" encoding="multipart/form-data" method="POST" action="CIMtrek_Regional_WhseForm_FileUpload">
   </form>
</iframe>

and this is how i submit the form which in iframe

function fileUpload() {

    //var UploadForm = document.forms["FileUploadForm"];
    var UploadForm = global.forms["FileUploadForm"];

    alert("Form : "+typeof global.forms["FileUploadForm"]);
    alert("Form : "+typeof global.forms["FileUploadFrame"]);
    iframeId = document.getElementById("FileUploadFrame");


    // Add event...
    var eventHandler = function () {

        if (iframeId.detachEvent) iframeId.detachEvent("onload", eventHandler);
        else iframeId.removeEventListener("load", eventHandler, false);

        // Message from server...
        if (iframeId.contentDocument) {
            content = iframeId.contentDocument.body.innerHTML;
        } else if (iframeId.contentWindow) {
            content = iframeId.contentWindow.document.body.innerHTML;
        } else if (iframeId.document) {
            content = iframeId.document.body.innerHTML;
        }

        document.getElementById(div_id).innerHTML = content;
    }
    if (iframeId.addEventListener) iframeId.addEventListener("load", eventHandler, true);
    if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);

    //alert('submitting form');
    //form.submit();
    //document.forms["FileUploadForm"].submit();
    alert(UploadForm.submit());
}

but i get the following exception when submitting the form :

Error: Unable to get value of the property 'submit': object is null or undefined

Please help me to find the problem and fix.

Best Regards

  • 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-06-18T11:36:15+00:00Added an answer on June 18, 2026 at 11:36 am

    The way to get the FileUploadForm is:

    iframeId = document.getElementById("FileUploadFrame");
    //This is the trick
    var ifrDoc = iframeId.contentDocument || iframeId.contentWindow.document;
    var UploadForm = ifrDoc.getElementById("FileUploadForm");
    

    Or you could have some code in the frame that sets a variable in parent to the form, but I wouldn’t trust that method.

    Source: accessing a form that is in an iframe


    EDIT:

    Also, for get the upload form valid it needs to looks just like any other form except:

    • the form tag must specify the POST method
    • the form tag must specify an enctype of multipart/form-data
    • the form must contain an <input type=file> element.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have html like this: <div> <span style=display: inline-block;height:20px>20</span> <span style=display: inline-block;><img src=img/ex.png/></span> </div>
I have an iframe with parameters inside the src url like this: <iframe src=http://www.form-page.com?suppressRedirect=1&A=1841
I have a simple form that looks like this: <form action=# name=submit method=post> <input
I have form like this: <form method=POST> <p> Nazwa kategorii: <br /> <input name=NazwaKat
I have an iframe that looks like this: <iframe id=iframe2 ...> #document <html>...</html> </iframe>
I have this iFrame in my parent window... <iFrame src=http://theirdomain.com id=Post_iFrame></iFrame> Then I have
I have a page, with a form, and I'd like to display a fancybox
I have a input from website which defines like this: <input type=text name=postdb[title] size=60
I have a form inside an iframe, and I'd like to prepopulate the form
I have a form. This form submits via POST to an iframe, that, in

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.