delay form submission - iframe access denied

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SSG001
    New Member
    • Oct 2007
    • 110

    delay form submission - iframe access denied

    i have a form and in that i iframe
    in the main form
    [HTML]<form name='form1>
    <iframe name="frame1" id="iframe1" src="iframe1.ph p" scrolling="yes" width="300%" frameborder="0" height="300"></iframe>
    <input type="button" name="save" onclick="save() ;">
    </form>
    [/HTML]
    [CODE=javascript]function save(){
    window.frames['iframe1'].document.forms['iniframe'].add.click();
    document.form1. submit();
    }
    [/CODE]
    this code submits the frame data from main form and also main form data but
    both the things are done at a time
    i want that once iframe is form submitted and allthe queries performed to insert data on the iframe form then only main form data should be submitted
    is there anyway to delay this
    Last edited by acoder; Jan 24 '08, 01:07 PM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the setInterval method.

    Remember to use code tags. You should know by now that you're expected to use code tags when posting code.

    Comment

    • SSG001
      New Member
      • Oct 2007
      • 110

      #3
      This is the command click the submit button on the iframe then similarily what
      command is used to submit the main form from iframe
      [CODE=javascript][window.frames['iniframe'].document.forms['ini'].add.click();[/CODE]

      I want to give the submit command from my iframe when all the queries of iframe are over say something like this

      document.form1. submit();
      instead of giving it in the save function of main form

      how do i access the main form from iframe for this

      Thanks in advance

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You should be able to access the main page using parent.

        Comment

        • SSG001
          New Member
          • Oct 2007
          • 110

          #5
          Iframe Access Denied

          [CODE=javascript]window.frames['frame1'].forms['form2'].add.click(); [/CODE]

          i have a main form where iframe is given
          and in the iframe shows some details now i have one save button on the main form which click the add button from the iframe
          i'm getting access denied erro
          i alerted
          [CODE=javascript]alert(window.fr ames.frame1.loc ation.href);[/CODE]
          and it alerts does not give me error for this then wot is the problem



          Thanks in advance

          Comment

          • SSG001
            New Member
            • Oct 2007
            • 110

            #6
            this works and show the date also in the iframe but whne i try to post it
            i'm getting an error access denied for this

            Comment

            • pronerd
              Recognized Expert Contributor
              • Nov 2006
              • 392

              #7
              Please do not post the same question repeatedly.

              I do not think you are allowed to do what you are trying. Unlike normal frame elements iFrames are not part of the existing window or document elements. So my understanding is that you can not access them with JavaScript. This restriction is intentional to prevent security problems.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                I've merged the threads.

                Moderator.

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Originally posted by pronerd
                  I do not think you are allowed to do what you are trying. Unlike normal frame elements iFrames are not part of the existing window or document elements. So my understanding is that you can not access them with JavaScript. This restriction is intentional to prevent security problems.
                  That's not strictly true. You can access iframe contents from the same domain. See, for example, this link.

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    Originally posted by SSG001
                    i have a main form where iframe is given
                    and in the iframe shows some details now i have one save button on the main form which click the add button from the iframe
                    i'm getting access denied erro
                    i alerted
                    [CODE=javascript]alert(window.fr ames.frame1.loc ation.href);[/CODE]
                    and it alerts does not give me error for this then wot is the problem
                    Is the iframe page from the same domain?

                    Comment

                    • SSG001
                      New Member
                      • Oct 2007
                      • 110

                      #11
                      Originally posted by acoder
                      Is the iframe page from the same domain?
                      actually my main form and inframe form is on one server
                      and the link to this both programs is given from the anohter server and both the servers are https
                      i tried running this locally it works without any error

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        It is a cross-domain problem then.
                        Originally posted by SSG001
                        and the link to this both programs is given from the anohter server and both the servers are https
                        Can you explain what you mean by "and the link to both programs"?

                        Comment

                        Working...