Jump to content
  • 0

Multiple actions for a datapage


Farnsbarnes

Question

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

  • 0

Thanks aam82

This sort of works, but it means my internal parameters will always be nulled.   If User hits 'submit', I want the internal parameters to re-load the User's selection in the listboxes.  It's only if User hits 'reset' that I want internal parameters to be nulled.

I could try using an 'if / else' statement in the webpage where I embed the iframe urls, but I would need to send some kind of flag from Caspio to the webpage to tell the HTML code whether 'submit' or 'reset' was pressed in Caspio.  I don't know how to do that.  Any ideas?

Thanks  

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...