Jump to content

[SOLVED] "Are you sure" after clicking submit


PirateBagel

Recommended Posts

I have a large form, a few people keep hitting "enter" or something in a text box, thus sending the whole incomplete document.

 

When they click on submit, i want a warning message to come up that says something along the lines of, "Are you sure you'd like to submit this?" with a yes/no option.

 

I know this is a simple code, i've had it before. But I cannot remember what the actual code is, nor can I find it.

 

Thanks for the help.

Link to comment
Share on other sites

the problem w/ onclick="return confirm('Are you sure?')" is that if they select "no" it will still send the form.

 

this should really be in javascript, but anyway:

 

onclick="var x = confirm('are your sure'); if(!x){ return false; }"

 

or

 

function rUsure(){
var confirmation = confirm("Are you Sure You want to submit this form");
if(confirmation == false){
return false;
}
}

<form action="" method="" onsubmit="return rUsure()"> </a>

Link to comment
Share on other sites

always works for me?

 

really? huh. maybe I was using a crappy browser the first time i tried using the confim() function.  It was a few years ago and I've just always used my work around assuming that its the only way it works. Apparently it may not be necessary.  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.