473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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(msubject){
var mailto = " \"mailto:wright\@wcc.govt.nz\"?Subject= ";
var subbase = "\"RAMM Record Carriageway Resurfacing Record" + "\"";
var contractno = document.resurfacingrecord.contract.value;
var method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + "\"" + contractno + "\"" + method;
window.status = (msub);
return (msub);
}
</script>

</HEAD>
<body>
<form name = "resurfacingrecord" action= 'javascript:mailsubject();' >

<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 5922
Note: I want to drive this from a submit button

Steve
"Steve Wright" <wr****@wcc.govt.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(msubject){
var mailto = " \"mailto:wright\@wcc.govt.nz\"?Subject= ";
var subbase = "\"RAMM Record Carriageway Resurfacing Record" + "\"";
var contractno = document.resurfacingrecord.contract.value;
var method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + "\"" + contractno + "\"" + method;
window.status = (msub);
return (msub);
}
</script>

</HEAD>
<body>
<form name = "resurfacingrecord" action= 'javascript:mailsubject();' >

<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.getElementById('formTest').innerHTML='';
//set up variables to generate dynamic subject line
var contractno = document.getElementById('contract').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.createElement('form');
f.setAttribute('name','formsendmail');
f.setAttribute('id','formsendmail');
f.setAttribute('action','mailto:wr****@wcc.govt.nz ?Subject=' +
msubject + ' Contract Number=' + contractno);
f.setAttribute('method',mmethod);

//insert new form into div
document.getElementById('formTest').appendChild(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="makeForm();document.getElementById('forms endmail').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['resurfacingrecord'];

var sub = "mailto:wr****@wcc.govt.nz?subject=RAMM Carriageway
Resurfacing Record " + (f.roadname.value) + " " + (f.startroad.value) + "-"
+ (f.endroad.value);

f.action = sub;

}

along with this as the form tag

<form name = "resurfacingrecord" action="about:blank" method="post"
enctype="text/plain" onSubmit="buildsubject()">

and this for the form button

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

"mscir" <ms***@access4less.com.net.org.uk> wrote in message
news:10*************@corp.supernews.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.getElementById('formTest').innerHTML='';
//set up variables to generate dynamic subject line
var contractno = document.getElementById('contract').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.createElement('form');
f.setAttribute('name','formsendmail');
f.setAttribute('id','formsendmail');
f.setAttribute('action','mailto:wr****@wcc.govt.nz ?Subject=' +
msubject + ' Contract Number=' + contractno);
f.setAttribute('method',mmethod);

//insert new form into div
document.getElementById('formTest').appendChild(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="makeForm();document.getElementById('forms endmail').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
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...
18
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...
2
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...
7
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" ...
5
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>...
3
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...
13
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"?...
6
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,...
2
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 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.