PDA

View Full Version : mailto


hughesmi
07-12-2002, 05:45 PM
Hi,

I have this form that takes the info and displaysthe info on a new page. It also validates the form as well.

But I want to also use the "mailto" to send the page info by email.

I just cant get it to do this, can anyone help.. Please.



Mike


<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// test variables
var myHeight = 200;
var isResizable = true;

function createTarget(form) {
_target = form.target;
_colon = _target.indexOf(":");
if(_colon != -1) {
form.target = _target.substring(0,_colon);
form.args = _target.substring(_colon+1);
} else if(typeof(form.args)=="undefined") {
form.args = "";
}
if(form.args.indexOf("{")!=-1) {
_args = form.args.split("{");
form.args = _args[0];
for(var i = 1; i < _args.length;i++) {
_args[i] = _args[i].split("}");
form.args += eval(_args[i][0]) + _args[i][1];
}
}
form.args = form.args.replace(/ /g,"");
_win = window.open('',form.target,form.args);
if(typeof(focus)=="function")
_win.focus();
return true;
}
// End -->
</script>





<title>Page</title>

<script language=JavaScript src="val.js"></script>


</HEAD>

<body bgcolor="#636363" leftmargin="0" onLoad="document.IVref.Full_Name.focus();document.IVref.reset()">
<center>
<font face="Tahoma" color="#FFFF00"><b>
Form Target Formatting.</b></font>
<p>
<font face="Tahoma"><b>
</b></font>
<FORM NAME="IVref" METHOD="get" ACTION="con1.htm" ENCTYPE="text/plain" onSubmit="return NewPage();return createTarget(this);MailIT();">

<table align=center height="98">
<tr><td align=right height="25"><font color="#ffff00" size="2" face="Tahoma"><b>Full
Name:</b></font></td>
<td height="25"><font face="Tahoma"><b><input style="FONT-WEIGHT: bold; TEXT-TRANSFORM: capitalize" size="36" name="Full_Name" span></b></font></td></tr>
<tr><td align=right height="25"><font color="#ffff00" size="2" face="Tahoma"><b>D.O.B:</b></font></td>
<td height="25"><font face="Tahoma"><b><input style="FONT-WEIGHT: bold; TEXT-TRANSFORM: capitalize" size="36" name="DOB" span font <></b></font></td></tr>
<tr><td align=right height="25"><font color="#ffff00" size="2" face="Tahoma"><b>Case
Number:</b></font></td>
<td height="25"><font face="Tahoma"><b><input style="FONT-WEIGHT: bold; TEXT-TRANSFORM: uppercase" maxLength="13" size="36" name="Case_ID" span></b></font></td></tr>
<tr>
<td align=right height="17"><font color="#ffff00" size="2" face="Tahoma"><b>Email
Address:</b></font></td>
<td height="17"><font face="Tahoma"><b><input style="FONT-WEIGHT: bold" size="36" name="Email_ID" span font < ?></b></font></td>
</tr>
<tr>
<td align=right height="9"><font color="#ffff00" size="2" face="Tahoma"><b>Telephone
Number:</b></font></td>
<td height="9"><font face="Tahoma"><b><input size="41" name="Phone"></b></font></td>
</tr>
<tr>
<td align=right height="49" valign="top"><font color="#ffff00" size="2" face="Tahoma"><b>Caller
Enquiry:</b></font></td>
<td height="49"><font color="#ffffff" size="2" face="Tahoma"><b><textarea style="FONT-WEIGHT: bold; FONT-FAMILY: Tahoma" name="IV_Message" rows="6" wrap="physical" cols="39"></textarea></b></font></td>
</tr>
<tr>
<td align=right height="19" valign="top"></td>
<td height="19">
<p align="center"><font face="Tahoma"><b><font color="#ffff00" size="2">Preferred
Contact: </font><!--webbot bot="Validation" B-Disallow-First-Item="TRUE" --><select size="1" name="Preferred_Contact">
<option selected>&lt;- Contact -&gt;</option>
<option value="Email">Email</option>
<option value="Phone">Phone</option>
<option value="Both">Both</option>
</select></b></font></td>
</tr>
<tr><td align=center colspan=2 height="27"><font face="Tahoma"><b><input onclick="return confirm('STOP!\n\nDo you want to reset the form?');" type="reset" value="Reset Form?"><input type="Submit"></b></font></td></tr>
</table>
</form>

Soldier Bob
07-12-2002, 06:08 PM
<script>
document.location="mailto:soldier_bob@hotmail.com?subject=Javascript Help: &body=Does this actually work &body=--------------------";
</script>

NS 4.7x
& IE 5.0 compliant this is :)

I will leave it up to you or someone else to walk through the form tree and append all the needed info.

Man this little snippet of code is giving me tons of neat ideas :)

-S. Bob

Soldier Bob
07-12-2002, 06:20 PM
<script> document.location="mailto:soldier_bob@hotmail.com,mike@aol.com,jon@user.net?subject=Javascript Help: &body=Does this actually work &body=--------------------";
</script>


humm... I suppose one could create their own mailto lists as .html page shortcuts sitting on their desktop. hummm.....

-S. Bob

hughesmi
07-15-2002, 08:34 AM
Hi,

Thanks for this. I can't see where to put this code?

I did try something like this, but I don't see how to collect the form data and when I submit the form, then send the info to a the mailto and then send the page to display the data submited.


It all works fine and dandy, but, I just want to collect all the info by email via the form, then send it to my mock cgi page to display the sumbited data.

hughesmi
07-15-2002, 09:17 AM
Just a small point, I have just notced that i dont think i need this, i can still sumbit the form and display the page info by uasnf my mock cgi page i.e. ..con1.htm

I just need the page to email using mailto


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// test variables
var myHeight = 200;
var isResizable = true;

function createTarget(form) {
_target = form.target;
_colon = _target.indexOf(":");
if(_colon != -1) {
form.target = _target.substring(0,_colon);
form.args = _target.substring(_colon+1);
} else if(typeof(form.args)=="undefined") {
form.args = "";
}
if(form.args.indexOf("{")!=-1) {
_args = form.args.split("{");
form.args = _args[0];
for(var i = 1; i < _args.length;i++) {
_args[i] = _args[i].split("}");
form.args += eval(_args[i][0]) + _args[i][1];
}
}
form.args = form.args.replace(/ /g,"");
_win = window.open('',form.target,form.args);
if(typeof(focus)=="function")
_win.focus();
return true;
}
// End -->
</script>