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 post
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 post
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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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