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=documen t.testform.theb ody.value;
window.location .href="mailto:s omeone@invalid. com?subject=Mai l
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=documen t.testform.theb ody.value;
var dropdown=docume nt.testform.dro pdown.value;
window.location .href="mailto:s omeone@invalid. com?subject=Mai l
Test&body=" +
(thebody)+(drop down);
}
</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>
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=documen t.testform.theb ody.value;
window.location .href="mailto:s omeone@invalid. com?subject=Mai l
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=documen t.testform.theb ody.value;
var dropdown=docume nt.testform.dro pdown.value;
window.location .href="mailto:s omeone@invalid. com?subject=Mai l
Test&body=" +
(thebody)+(drop down);
}
</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>
Comment