Javascript onsubmit form confirm

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

scrubbicus

Thread Starter
Joined
Jan 23, 2009
Messages
197
I'm trying to write some quick javascript so when someone submits a form it asks them if they want to submit it or not. I got the confirm coming up but if they press cancel it still submits.

I'm trying:

function test()
{
answer = confirm("Are you sure?");

if(answer)
{

}
else
{
return false;
}
}

<form method="post" action="#" onsubmit="test()">
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Top