[thelist] JAVASCRIPT: confirmation dialog box that actually w orks!

David at softv.net David at softv.net
Thu Aug 29 12:07:01 CDT 2002


correct,

I was going to leave that up to Chris to figure out ;-)
A more complete example is:

<form method="POST" onSubmit="return validate();">
<input type="submit" value="Test" id="myButton">

<script language="JavaScript">

function validate()
{
	conf = confirm("Are you sure?");
	if (conf)
		return true
	else
		return false;
}

</script>
</form>

<%
David Mitchell
Application Developer
david at sofTV.net
sofTV.net
www.sofTV.net
613.729.6400 x268
%>

-----Original Message-----
From: James Aylard [mailto:evolt at pixelwright.com]
Sent: Thursday, August 29, 2002 1:00 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] JAVASCRIPT: confirmation dialog box that actually
works!


David,

> Give this a try:
>
> <form action="" method="POST">
> <input type="Button" value="Test" id="myButton" onClick="validate()">
>
> <script language="JavaScript">
>
> function validate()
> {
> conf = confirm("Are you sure?");
> document.write(conf);
> }
>
> </script>
> </form>

    But this does nothing to cancel the form submission. To do that, you
need to return false in the onsubmit event of the form.

James Aylard

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list