I have 2 iframes on one webpage, one is a search submission datapage, the other a results datapage
When I press a 'reset' button that I've created, I want the internal parameters in the search page to reset to null, but I also want the results page to update to a "Search couldn't find data" screen (otherwise I still see the results from the previous search). Refreshing the webpage URL adding "cbResetParam=1" has no effect, probably because the datapages are in iframes.
So my thinking is that, (first) I should null the search datapage internal parameters, and this I can do with the 3rd line of code below. Then, (2nd) I need to 'submit' the search page, so that the results page updates with the null internal parameters I've just set. Both these code instructions work well independently, But when I combine them, as below, line 3 won't execute. Only line 5 executes. The result is that the whole webpage (incl. iframes) refreshes, but the internal parameters are not nulled. I've tried putting "&cbResetParam=1" on the end of the url on line 5, but there's no effect. Am I wrong to think that 2 actions can run simultaneously under one 'submit' function? Is my code just rubbish (which wouldn't surprise me)?
function mygosubmit(){
var thisURL = location.href;
location.href = thisURL +"&cbResetParam=1"; // THIS LINE WON'T EXECUTE !!
if (window.parent && window.parent.postMessage) {
window.parent.postMessage("refresh", "http://my_web_page_url.html"); // THIS LINE DOES EXECUTE !!
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Farnsbarnes
Hi all,
I have 2 iframes on one webpage, one is a search submission datapage, the other a results datapage
When I press a 'reset' button that I've created, I want the internal parameters in the search page to reset to null, but I also want the results page to update to a "Search couldn't find data" screen (otherwise I still see the results from the previous search). Refreshing the webpage URL adding "cbResetParam=1" has no effect, probably because the datapages are in iframes.
So my thinking is that, (first) I should null the search datapage internal parameters, and this I can do with the 3rd line of code below. Then, (2nd) I need to 'submit' the search page, so that the results page updates with the null internal parameters I've just set. Both these code instructions work well independently, But when I combine them, as below, line 3 won't execute. Only line 5 executes. The result is that the whole webpage (incl. iframes) refreshes, but the internal parameters are not nulled. I've tried putting "&cbResetParam=1" on the end of the url on line 5, but there's no effect. Am I wrong to think that 2 actions can run simultaneously under one 'submit' function? Is my code just rubbish (which wouldn't surprise me)?
function mygosubmit(){
var thisURL = location.href;
location.href = thisURL +"&cbResetParam=1"; // THIS LINE WON'T EXECUTE !!
if (window.parent && window.parent.postMessage) {
window.parent.postMessage("refresh", "http://my_web_page_url.html"); // THIS LINE DOES EXECUTE !!
}}
document.getElementById("caspioform").onsubmit= mygosubmit;
Many thanks for any help or hints
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.