Help with mailto: and form results in message body

G

G. Morgan

I don't have access to a server-side solution, so I guess Javascript
is my only choice.

I want to pass a bunch of form fields to an email, but unsure of how
to add the multiple fields into the body section.

What I want to add is the "dropdown" data merged into the body of the
email.
I found this example code (that works just the way I want it to,
except I want to add more data).
My changes are below it:

<script>
function now()
{
var thebody=document.testform.thebody.value;
window.location.href="mailto:[email protected]?subject=Mail
Test&body=" +
escape(thebody);
}
</script>
<form name=testform>
<input type=button value="click me" onclick="now()">
<textarea name=thebody>
This is test email body data.
</textarea>
</form>


----------------------------------
My changes
----------------------------------
<script>
function now()
{
var thebody=document.testform.thebody.value;
var dropdown=document.testform.dropdown.value;
window.location.href="mailto:[email protected]?subject=Mail
Test&body=" +
(thebody)+(dropdown);
}
</script>
<form name=testform>
<input type=button value="click me" onclick="now()">
<textarea name=thebody>
This is test email body data.
</textarea>

<select size="1" name="dropdown">
<option>yes</option>
<option>no</option>
</select></form>
 
T

Thomas 'PointedEars' Lahn

G. Morgan said:
I don't have access to a server-side solution,

Get one.
so I guess Javascript is my only choice.

I want to pass a bunch of form fields to an email, but unsure of how
to add the multiple fields into the body section. [...]

Client-side scripting is not going to provide an equivalent solution here.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top