By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,144 Members | 849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,144 IT Pros & Developers. It's quick & easy.

delay form submission - iframe access denied

100+
P: 110
i have a form and in that i iframe
in the main form
[HTML]<form name='form1>
<iframe name="frame1" id="iframe1" src="iframe1.php" scrolling="yes" width="300%" frameborder="0" height="300"></iframe>
<input type="button" name="save" onclick="save();">
</form>
[/HTML]
Expand|Select|Wrap|Line Numbers
  1. function save(){
  2. window.frames['iframe1'].document.forms['iniframe'].add.click();
  3. document.form1.submit();
  4. }
  5.  
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
Jan 24 '08 #1
Share this Question
Share on Google+
11 Replies


acoder
Expert Mod 15k+
P: 16,027
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.
Jan 24 '08 #2

100+
P: 110
This is the command click the submit button on the iframe then similarily what
command is used to submit the main form from iframe
Expand|Select|Wrap|Line Numbers
  1. [window.frames['iniframe'].document.forms['ini'].add.click();
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
Jan 25 '08 #3

acoder
Expert Mod 15k+
P: 16,027
You should be able to access the main page using parent.
Jan 25 '08 #4

100+
P: 110
Expand|Select|Wrap|Line Numbers
  1. window.frames['frame1'].forms['form2'].add.click(); 
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
Expand|Select|Wrap|Line Numbers
  1. alert(window.frames.frame1.location.href);
and it alerts does not give me error for this then wot is the problem



Thanks in advance
Apr 30 '08 #5

100+
P: 110
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
Apr 30 '08 #6

Expert 100+
P: 392
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.
Apr 30 '08 #7

acoder
Expert Mod 15k+
P: 16,027
I've merged the threads.

Moderator.
May 1 '08 #8

acoder
Expert Mod 15k+
P: 16,027
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.
May 1 '08 #9

acoder
Expert Mod 15k+
P: 16,027
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
Expand|Select|Wrap|Line Numbers
  1. alert(window.frames.frame1.location.href);
and it alerts does not give me error for this then wot is the problem
Is the iframe page from the same domain?
May 1 '08 #10

100+
P: 110
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
May 2 '08 #11

acoder
Expert Mod 15k+
P: 16,027
It is a cross-domain problem then.
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"?
May 2 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.