Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I show an Alert box when Submit is clicked?

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

I'm using Matt Wright's FormMail script to send form submissions back from my site.

I'd like it so that when a user clicks Submit it displays an Alert box as an indication that something happened, rather than redirecting them to a new page.

Is it possible to open an Alert box when Submit is clicked?


- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 

>> Is it possible to open an Alert box when Submit is clicked?

Probably - although I'm not familiar with the script that you mention, the following will give you an alert. I'm sure you can tie it in with the code you have:

Code:
alert('This is an alert!');

Hope this helps,
Dan
 
You can even take this one step further and confirm that this is the action the user intended to take allowing them to cancel submission and make changes to the form:
Code:
<html>
<head>
<title>Submission Test</title>
<script language=javascript>
function validateSubmission() {
   //you could use the alert here if that's what you choose
   //alert("form being submitted");
   //or confirm the user's action:
   return confirm("Are you sure you want to submit the form?");
}
</script>
</head>
<body>
<form name=blahForm onsubmit='return validateSubmission()'>
<input type=submit value='click me'>
</form>
</body>
</html>

-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top