469,306 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Unexpected result

Can someone please tell me why the following code generates a new page with

"mailto:wr****@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing
Record" Method="POST" enctype="text/plain"

as a single line rather that generation an email?

<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 method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + method;
window.status = (msub);
return (msub);
alert(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
7 1166
Lee
Steve Wright said:

Can someone please tell me why the following code generates a new page with

"mailto:wr****@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing
Record" Method="POST" enctype="text/plain"

as a single line rather that generation an email?

<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 method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + method;
window.status = (msub);
return (msub);
alert(msub);
}
</script>

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


The action attribute identifies the new page to load.
You've said that the new page to load is what is returned
by the mailsubject() function. The return value of the
mailsubject() function is exactly what you're seeing.

Jul 23 '05 #2
OK,

What I had intended was that an Email be sent with the subject of "RAMM
Record Carriageway Resurfacing Record". I know that I can Hard code this
but I wanted to extend the funcion to include a number of form fields in the
subject.

Steve
"Lee" <RE**************@cox.net> wrote in message
news:c8*********@drn.newsguy.com...
Steve Wright said:

Can someone please tell me why the following code generates a new page with
"mailto:wr****@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing
Record" Method="POST" enctype="text/plain"

as a single line rather that generation an email?

<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 method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + method;
window.status = (msub);
return (msub);
alert(msub);
}
</script>

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


The action attribute identifies the new page to load.
You've said that the new page to load is what is returned
by the mailsubject() function. The return value of the
mailsubject() function is exactly what you're seeing.

Jul 23 '05 #3
Lee
Steve Wright said:

OK,

What I had intended was that an Email be sent with the subject of "RAMM
Record Carriageway Resurfacing Record". I know that I can Hard code this
but I wanted to extend the funcion to include a number of form fields in the
subject.


You might want this:

<form name="resurfacingrecord"
action="mailto:wr****@wcc.govt.nz"
onsubmit="this.action=mailsubject()">

But you should be aware that mailto: is completely unreliable.
You have know assurance that your customer has a mail client
configured to work with their browser.

Jul 23 '05 #4
Lee,
When I use

<form name = "Resurfacing record" action =
mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain">

I get an email back with all the form fields as I would expect.

all I am trying to do is get

"mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain""

pased to the action so that I can add some of the form fields to the
subject.

Steve
"Lee" <RE**************@cox.net> wrote in message
news:c8*********@drn.newsguy.com...
Steve Wright said:

Can someone please tell me why the following code generates a new page with
"mailto:wr****@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing
Record" Method="POST" enctype="text/plain"

as a single line rather that generation an email?

<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 method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + method;
window.status = (msub);
return (msub);
alert(msub);
}
</script>

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


The action attribute identifies the new page to load.
You've said that the new page to load is what is returned
by the mailsubject() function. The return value of the
mailsubject() function is exactly what you're seeing.

Jul 23 '05 #5
Lee
Steve Wright said:

Lee,
When I use

<form name = "Resurfacing record" action =
mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain">

I get an email back with all the form fields as I would expect.

all I am trying to do is get

"mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain""

pased to the action so that I can add some of the form fields to the
subject.


The example code I posted should do that for you.
However, I warn you again that this will not work for all visitors
to your web site. "mailto:" will only work if you happen to have
a mail client configured in your browser. The fact that it works
for you means that you have your browser configured to work that
way.

Jul 23 '05 #6
Lee

All that seems to do is open a blank Email!

Steve
PS Ive been using the mailto; sucsessfully for collection of the info until
now with a hard coded subject but I need to add some form fields to make the
resulting emails identifiable.
"Lee" <RE**************@cox.net> wrote in message
news:c8********@drn.newsguy.com...
Steve Wright said:

Lee,
When I use

<form name = "Resurfacing record" action =
mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain">

I get an email back with all the form fields as I would expect.

all I am trying to do is get

"mailto:wr****@wcc.govt.nz?subject=RAMM Resurfacing Record method = post
enctype="text/plain""

pased to the action so that I can add some of the form fields to the
subject.


The example code I posted should do that for you.
However, I warn you again that this will not work for all visitors
to your web site. "mailto:" will only work if you happen to have
a mail client configured in your browser. The fact that it works
for you means that you have your browser configured to work that
way.

Jul 23 '05 #7
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">

"Steve Wright" <wr****@wcc.govt.nz> wrote in message
news:1084501423.178254@muldoon...
Can someone please tell me why the following code generates a new page with
"mailto:wr****@wcc.govt.nz"?Subject= "RAMM Record Carriageway Resurfacing
Record" Method="POST" enctype="text/plain"

as a single line rather that generation an email?

<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 method = " Method=" + "\"POST\"" + " enctype=" +"\"text" + "\/"
+"plain\"";
msub = mailto + subbase + method;
window.status = (msub);
return (msub);
alert(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 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by sky2070 | last post: by
2 posts views Thread by Salim | last post: by
6 posts views Thread by Ehartwig | last post: by
62 posts views Thread by ashu | last post: by
13 posts views Thread by bintom | last post: by
2 posts views Thread by =?Utf-8?B?QXJtaW4gR2FsbGlrZXI=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.