Click to See Complete Forum and Search --> : help!!! form using mailto:


impulse
12-26-2002, 09:28 AM
I'm still new to javascript and I would appreciate any help.

I'm using the action=mailto:email@com to see if my form works correctly. When I submit the form, instead of sending the form to the email address, it opens a blank email page. Why? Is it because of MSIE 6? Please help!

Here is the script below:


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript" type="text/javascript">
<!--

function myValid(){
if(document.myForm.first_name.value==""){
alert("Please enter your first name!")
document.myForm.first_name.focus()
return false
}
if(document.myForm.last_name.value==""){
alert("Please enter your last name!")
document.myForm.last_name.focus()
return false
}
if(document.myForm.company.value==""){
alert("Please enter your company's name!")
document.myForm.company.focus()
return false
}
if(document.myForm.address.value==""){
alert("Please enter your address!")
document.myForm.address.focus()
return false
}
if(document.myForm.city.value==""){
alert("Please enter your city!")
document.myForm.city.focus()
return false
}
if(document.myForm.zipCode.value==""){
alert("Please enter your zip code!")
document.myForm.zipCode.focus()
return false
}
if(document.myForm.state.value==""){
alert("Please enter your state!")
document.myForm.state.focus()
return false
}
if(document.myForm.country.value==""){
alert("Please enter your country!")
document.myForm.country.focus()
return false
}
if(document.myForm.email.value==""){
alert("Please enter your email address!")
document.myForm.email.focus()
return false
}
return true
}
//-->
</script>

</head>

<body bgcolor="#FFFFFF">

<form name="myForm" method="post" onSubmit="return myValid()" action="mailto:email@site.com" ENCTYPE="text/plain">
<table width="566" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#FF0000">First
Name: </font> <font color="#FF0000">
<input type="text" name="first_name" size="30" maxlength="30">
<font size="2" face="Arial, Helvetica, sans-serif">Last Name: </font></font>
<font color="#FF0000">
<input type="text" name="last_name" size="30" maxlength="30">
<br>
<font face="Arial, Helvetica, sans-serif" size="2">Company Name:
<input type="text" name="company" size="30" maxlength="30">
<br>
Address:
<input type="text" name="address" size="30" maxlength="30">
City:
<input type="text" name="city" size="30" maxlength="30">
<br>
Zip Code:
<input type="text" name="zipCode" size="5" maxlength="10">
State:
<input type="text" name="state" size="2" maxlength="2">
Country:
<input type="text" name="country" size="25" maxlength="40">
</font></font> <font color="#FF0000"><br>
<font face="Arial, Helvetica, sans-serif" size="2">Email: </font></font>
<font color="#FF0000">
<input type="text" name="email" size="30" maxlength="40">
</font> <br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
<input type="button" name"Valid" value="Valid">
</div>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

swon
12-26-2002, 01:36 PM
It works fine, in IE6. Do you have an standard email programm on your computer installed, like MS Outlook or something like that? If not, it will not works with an mailto.

impulse
12-26-2002, 02:07 PM
Yes, I have MS Outlook.

swon
12-26-2002, 02:25 PM
Is your page online?

impulse
12-26-2002, 02:41 PM
Here is the site page.

http://www.impulsenc.com/htm/new_form.htm (http://impulsenc.com/htm/new_form.htm)

swon
12-26-2002, 03:04 PM
It works, I've sent an test-mail. Maybe there's something disabled in your browser options.

impulse
12-26-2002, 03:07 PM
You're right. I received your test-mail and it works! I will check the browser options. Thanks!

impulse
12-27-2002, 11:55 AM
I have checked my browser options. I do not see anything that would cause my problem. I have re-install MS Outlook and IE6.

Does anyone have a clue on what is causing my problem?

swon
12-27-2002, 12:01 PM
Sorry, no more idea, but you should maybe better use an server side language instead of the mailto function. For example with PHP or ASP...
With the server side programming you doesn't have any problem like that!

impulse
12-27-2002, 12:04 PM
Thanks for your help. I will look into your suggestion.