Click to See Complete Forum and Search --> : Form question - validate then confirm email address


chrisw184
08-27-2003, 06:01 AM
Hi,
I have a form which is validated using JavaScript and is called up in the FORM tag [onsubmit="return Validate()"] but I also want a JavaScript alert to appear when the form is correctly validated when the user clicks on the submit button which displays the email address entered in the form and asking for a confirmation before sending to the next page.

Is this possible all on one form??

Regards

Chris W

Fang
08-27-2003, 06:37 AM
This should do:

function Validate() {
// code for validation here

if(valid) {
if(confirm("Email address correct?\n"+document.myform.email.value)) {
document.myform.submit();
return true;
}
}
else {
alert("Error somewhere");
}
return false;
}
.
.
.
<form action="NextPage.html" method="post" name="myform" onsubmit="Validate();return false;">
<!-- rest of form follows -->