Jump to content

Update form use Javascript to show message & close window


Recommended Posts

Hello all, 

I have an Update datapage where, on Submit, I need to 1) show a popup message saying the changes were saved and 2) close the window or tab of the host page. 

I set the 'destination' of the datapage to 'Close Window' and put the below js in the footer to show the message.

<SCRIPT LANGUAGE="JavaScript">

function myFunction()
{
alert ('Your updates have been saved')
}
document.getElementById("caspioform").onsubmit = myFunction;

</SCRIPT>

The problem is the js seems to block the 'Close Window' function and the page just refreshes to 'same form' and shows the standard 'data has been updated' message. 

So it seems to me I could put some kind of 'close window' function in the above js and put that in the 'message' section of the Destination wizard.  I tried the below but it doesn't actually close the window/tab. 

<SCRIPT LANGUAGE="JavaScript">

function myFunction()
{
alert ('Your updates have been saved');

window.close();

}
document.getElementById("caspioform").onsubmit = myFunction;

</SCRIPT>

 

Basically, I need, on Submit, the tab/window to close and a message to pop up saying data has been saved. Does anyone know how to do this? 

Link to comment
Share on other sites

  • 10 months later...
  • 8 months later...

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
Reply to this topic...

×   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...