Jump to content

Java popup to prevent form from submitting


Recommended Posts

Hi all,

I'm trying to make a javascript popup that if "cancel" is selected, the form does not submit (and the user updates their selection before clicking submit again)

Here's what I have so far:

function show_confirm()

{

var r=confirm("You have indicated that this is an escape, are you sure you wish to submit?");

if (r==true)

{

alert("Escape Submitted");

}

else

{

What goes here?

}

}

/* On submitting the webform, the function calculate is executed */

document.getElementById("caspioform").onsubmit=show_confirm;

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Insert code into the footer

<script type="text/javascript">

function show_confirm()
{
var r=confirm("You have indicated that this is an escape, are you sure you wish to submit?");
if (r==true)
{
   document.getElementById("caspioform").submit();
}
else
{
alert("Escape Submitted");
return false;

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

</script>

Let me know if this helps.

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

×
×
  • Create New...