473,666 Members | 2,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mailto: with subject containing form field values.

I want to build an email subject containing text and a form field.

Have have got so far but all I seem to be able to do is generate another
page in the browser with a text string. (code attached)

I think that some how I need to pass the generated string as the action but
can't figure how to do it.

Can someone please tell me where I am going wrong and maybe suggest a
solution.

TIA
Steve
--
<HTML>
<TITLE> test</TITLE>
<HEAD>

<script language = "javascript ">

function mailsubject(msu bject){
var mailto = " \"mailto:wright \@wcc.govt.nz\" ?Subject= ";
var subbase = "\"RAMM Record Carriageway Resurfacing Record" + "\"";
var contractno = document.resurf acingrecord.con tract.value;
var method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + "\"" + contractno + "\"" + method;
window.status = (msub);
return (msub);
}
</script>

</HEAD>
<body>
<form name = "resurfacingrec ord" action= 'javascript:mai lsubject();' >

<select name="contract" >
<option value="">Select Contract</option>
<option value="RS-330">RS-330 Northern</option>
<option value="RS-331">RS-331 Southern</option>
</select>
<input type=submit value="Send Record">

</form>
</HTML>
--
Jul 23 '05 #1
3 5950
Note: I want to drive this from a submit button

Steve
"Steve Wright" <wr****@wcc.gov t.nz> wrote in message
news:1084757473 .167042@muldoon ...
I want to build an email subject containing text and a form field.

Have have got so far but all I seem to be able to do is generate another
page in the browser with a text string. (code attached)

I think that some how I need to pass the generated string as the action but can't figure how to do it.

Can someone please tell me where I am going wrong and maybe suggest a
solution.

TIA
Steve
--
<HTML>
<TITLE> test</TITLE>
<HEAD>

<script language = "javascript ">

function mailsubject(msu bject){
var mailto = " \"mailto:wright \@wcc.govt.nz\" ?Subject= ";
var subbase = "\"RAMM Record Carriageway Resurfacing Record" + "\"";
var contractno = document.resurf acingrecord.con tract.value;
var method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + "\"" + contractno + "\"" + method;
window.status = (msub);
return (msub);
}
</script>

</HEAD>
<body>
<form name = "resurfacingrec ord" action= 'javascript:mai lsubject();' >

<select name="contract" >
<option value="">Select Contract</option>
<option value="RS-330">RS-330 Northern</option>
<option value="RS-331">RS-331 Southern</option>
</select>
<input type=submit value="Send Record">

</form>
</HTML>
--

Jul 23 '05 #2
Steve Wright wrote:
Note: I want to drive this from a submit button
I want to build an email subject containing text and a form field.

<snip>

Warning: This will have poor browser support, IE5+ NS6+ if I understand
it correctly:

<HTML>
<HEAD>
<TITLE>test mail send</TITLE>
<script type="text/javascript">
function makeForm(){
//clear div of any previous forms that might have been generated by
this function
document.getEle mentById('formT est').innerHTML ='';
//set up variables to generate dynamic subject line
var contractno = document.getEle mentById('contr act').value;
var mmethod = 'Method="POST" enctype="text/plain"';
var msubject= 'RAMM Record Carriageway Resurfacing Record';

// create new form on page, set it's attributes
var f=document.crea teElement('form ');
f.setAttribute( 'name','formsen dmail');
f.setAttribute( 'id','formsendm ail');
f.setAttribute( 'action','mailt o:wr****@wcc.go vt.nz?Subject=' +
msubject + ' Contract Number=' + contractno);
f.setAttribute( 'method',mmetho d);

//insert new form into div
document.getEle mentById('formT est').appendChi ld(f);

}
</script>

</HEAD>
<body>

<select name="contract" id="contract">
<option value="">Select Contract</option>
<option value="RS-330">RS-330 Northern</option>
<option value="RS-331">RS-331 Southern</option>
</select>

<input type=button
onclick="makeFo rm();document.g etElementById(' formsendmail'). submit()"
value="Send Record">

<div id="formTest"> </div>

</body>
</HTML>

Mike

Jul 23 '05 #3
This is what I eventually used which does exactly what I want.

function buildsubject()

{

var f = document.forms['resurfacingrec ord'];

var sub = "mailto:wr****@ wcc.govt.nz?sub ject=RAMM Carriageway
Resurfacing Record " + (f.roadname.val ue) + " " + (f.startroad.va lue) + "-"
+ (f.endroad.valu e);

f.action = sub;

}

along with this as the form tag

<form name = "resurfacingrec ord" action="about:b lank" method="post"
enctype="text/plain" onSubmit="build subject()">

and this for the form button

<input type=submit value="Send Record">

"mscir" <ms***@access4l ess.com.net.org .uk> wrote in message
news:10******** *****@corp.supe rnews.com...
Steve Wright wrote:
Note: I want to drive this from a submit button
I want to build an email subject containing text and a form field.

<snip>

Warning: This will have poor browser support, IE5+ NS6+ if I understand
it correctly:

<HTML>
<HEAD>
<TITLE>test mail send</TITLE>
<script type="text/javascript">
function makeForm(){
//clear div of any previous forms that might have been generated by
this function
document.getEle mentById('formT est').innerHTML ='';
//set up variables to generate dynamic subject line
var contractno = document.getEle mentById('contr act').value;
var mmethod = 'Method="POST" enctype="text/plain"';
var msubject= 'RAMM Record Carriageway Resurfacing Record';

// create new form on page, set it's attributes
var f=document.crea teElement('form ');
f.setAttribute( 'name','formsen dmail');
f.setAttribute( 'id','formsendm ail');
f.setAttribute( 'action','mailt o:wr****@wcc.go vt.nz?Subject=' +
msubject + ' Contract Number=' + contractno);
f.setAttribute( 'method',mmetho d);

//insert new form into div
document.getEle mentById('formT est').appendChi ld(f);

}
</script>

</HEAD>
<body>

<select name="contract" id="contract">
<option value="">Select Contract</option>
<option value="RS-330">RS-330 Northern</option>
<option value="RS-331">RS-331 Southern</option>
</select>

<input type=button
onclick="makeFo rm();document.g etElementById(' formsendmail'). submit()"
value="Send Record">

<div id="formTest"> </div>

</body>
</HTML>

Mike

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
29904
by: Val | last post by:
Any experts on mailto: tags? I want to set a link so that the subject and some of the body of the email is filled in. This is easy for simple text, although you need to use %20 for spaces: <a href="mailto:nobody@nowhere.com ?subject=Your web site &body=This%20is%20the%20%body!"> click here</a>
18
28338
by: Shinin | last post by:
I am trying to set up a mailto: link so that the actual address that the email is being sent to is obscured and replaced by a name. For example, I have <a href="mailto:jschmoe@abc.com">Joe Schmoe</a>. When this link is clicked, an email window appears in the clicker's email client where the To: field is jschmoe@abc.com. What I want to have displayed there is Joe Schmoe. I've seen it suggested that formatting the link like this: <a...
2
2302
by: Wayne Wengert | last post by:
I am using VB.NET and invoking a function that opens the user's default mail client with a pre-stored list of email addresses and subject. I find that if the string containing the list of email addresses is longer than about 250 chars, I get an error complaining that "Object reference not set to an instance of an object.". If the list of emails is less than about 250 chars, everything works fine. Does anyone have a solution for this or an...
7
1295
by: Steve Wright | last post by:
Can someone please tell me why the following code generates a new page with "mailto:wright@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing Record" Method="POST" enctype="text/plain" as a single line rather that generation an email? <HTML>
5
4053
by: Olaf | last post by:
I have a ASP page that after saveing data to the database it will write the following script code to the page: <script> document.location='mailto:or@mailadr.se?body=http://myWebserver/page.asp?docID=17&login=HAL&subject=report'; </script> This all looks well but when I se the actual mail the &login=LAS part of the link in the body is not there! The subject is correct! It all looks ok apart from the missing part of the links querystring.
3
2225
by: Yogi_Bear_79 | last post by:
I am building a stand alone html help system (.chm.) So the usual woes with mailto are not going to be encountered. Likewise I am ensured all my intended users have Outlook installed. With that said This is what I want to do. I have a simple html form with a an radio button option group, a listmenu, a text box, and a text area. What I would like to do is have a user fill out this form, and hit a button that sends the results via...
13
7091
by: John Baker | last post by:
HI; Quick question: How do I specify an email subject when using the setup <a href="mailto:dogs@cats.com">Mail to the cat</a> Can someone show me how it would look if the subject was "mice"? Thanks a lot
6
7388
by: 35th Ave Media | last post by:
Hello, I have about 60+ pages that I need to insert a MAILTO: tag so people can email the page using their email client. The body of the message is going to be the URL of that page. Using ASP, how can I insert the page URL in the email body without having to manually enter each URL for each MAILTO: tag? Is there a variable that can be used inside the MAILTO: tag that automatically inserts the current page's URL into the body of the...
2
1782
by: Pramod | last post by:
Hello, I need specify the value of a text field in the subject field while using the MAILTO protocol in a HTML page., Can any one help me in this regard, whether the same is possible or not Thanks in advance Pramod
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8363
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8787
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.