PDA

View Full Version : confirm?


hughesmi
09-13-2002, 11:56 AM
Is there a way I can use a confirmation page once ,I have vaildated my form and then emailed using the mailto?

I have have tried to use this but I cant make it work.

linkid="confirmed.htm"
setTimeout('location.href=linkid',1000)


any ideas?

<script language="javascript" type="text/javascript">
<!--
function validate(form){
if(form.Name.value==""){
alert("Full Name is a Required Field");
form.Name.focus();
return false;
} else
if(form.DOB.value==""){
alert("DOB is a Required Field");
form.DOB.focus();
return false;
} else
if(form.Case_Number.value==""){
alert("Case Number is a Required Field");
form.Case_Number.focus();
return false;
} else
if(form.Email.value==""){
alert("Email is a Required Field");
form.Email.focus();
return false;
} else
if(form.Phone.value==""){
alert("Telephone Number is a Required Field");
form.Phone.focus();
return false;
} else
if(form.IV_Message.value==""){
alert("IV Message is a Required Field");
form.IV_Message.focus();
return false;
} else
if(form.Preferred_Contact.value==""){
alert("Please Select a Contact Method");
form.Preferred_Contact.focus();
return false;
} else
return (confirm("Is Your IV Message Correct?\n\n\n "+form.IV_Message.value))? true: false;
}
//-->
</script>
<form action="mailto:email.co.uk" enctype="text/plain" method="post" onsubmit="return validate(this)">

ShriekForth
09-13-2002, 04:16 PM
I'm not sure I understand. You want to have the confirmed.htm page only come up once, and the page you are on is the confirmed.htm page?


<script type="text/javascript" language="JavaScript">
function doRefresh(){
var str = new String(document.location);
vars = str.split("=");
if(vars[1] != 1){
linkid="confirmed.htm?x=1"
setTimeout('location.href=linkid',1000)
}
}
</script>


That would refresh the page only once, if you have onLoad="doRefresh()" in the body tag.

ShriekForth

hughesmi
09-14-2002, 12:40 PM
sorry I should have made myself more clear.


The form submits the page by email as you can see. So what I want is when a someone submits the form, I want to send them to a confirmation page, to say that there info has been sent.

ShriekForth
09-14-2002, 02:43 PM
Then what you want is

if(confirm("Is Your IV Message Correct?\n\n\n "+form.IV_Message.value)){
window.location='confirm.htm';
}

I don't know of a way to determine that they actually used their mail agent to send it, This form is only going to open up the default email client.

ShriekForth

hughesmi
09-16-2002, 09:33 AM
thanks this was spot on.


:)

Mikey