By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,261 Members | 1,658 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,261 IT Pros & Developers. It's quick & easy.

Unexpected result

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.