I'm having difficulty passing text to the body of an email with carriage returns.
I have a page that passes checkbox values from one form to the other with each value on its own line. The form that received the values then generates an email. The problem is once the data is pushed into the email the lines become merged together.
Any suggestions on who to keep the lines separate in the body of the email? Is there a way to read TEXTAREA line by line?
Below is the Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function PopulateBody() {
output = ''
for(i=0; i < document.Parts.checkbox.length; i++)
{
if (document.Parts.checkbox.checked)
{
output += document.Parts.checkbox.value + '\r' ;
}
}
document.eMail.body.value = output;
}
function MailIt()
{
var S=document.eMail.subject.value;
var B=document.eMail.body.value;
self.location="mailto:someone@somewhere.com?subject="+S+"&body="+B;
}
// End -->
</SCRIPT>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="Parts">
<p>This form populates the one below with only the checked checkboxes</p>
<p>
<input type="checkbox" name="checkbox" value="A">
A<br>
<input type="checkbox" name="checkbox" value="B">
B<br>
<input type="checkbox" name="checkbox" value="C">
C<br>
<input type="checkbox" name="checkbox" value="D">
D<br>
<input type="button" name="Submit" value="Populate Body" onClick="PopulateBody()">
</p>
</form>
<form name="eMail" method="post" ENCTYPE="text/plain">
Email Form
<p>Recipient
<input type="text" name="Recipient">
<br>
Subject
<input type="text" name="subject" value="No Subject">
<br>
<textarea name="body" cols="50" rows="10" wrap="OFF"></textarea>
</p>
<p>
<input type="button" name="Submit2" value="Submit" onClick="MailIt()">
</p>
</form>
</body>
</html>
I have a page that passes checkbox values from one form to the other with each value on its own line. The form that received the values then generates an email. The problem is once the data is pushed into the email the lines become merged together.
Any suggestions on who to keep the lines separate in the body of the email? Is there a way to read TEXTAREA line by line?
Below is the Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function PopulateBody() {
output = ''
for(i=0; i < document.Parts.checkbox.length; i++)
{
if (document.Parts.checkbox.checked)
{
output += document.Parts.checkbox.value + '\r' ;
}
}
document.eMail.body.value = output;
}
function MailIt()
{
var S=document.eMail.subject.value;
var B=document.eMail.body.value;
self.location="mailto:someone@somewhere.com?subject="+S+"&body="+B;
}
// End -->
</SCRIPT>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="Parts">
<p>This form populates the one below with only the checked checkboxes</p>
<p>
<input type="checkbox" name="checkbox" value="A">
A<br>
<input type="checkbox" name="checkbox" value="B">
B<br>
<input type="checkbox" name="checkbox" value="C">
C<br>
<input type="checkbox" name="checkbox" value="D">
D<br>
<input type="button" name="Submit" value="Populate Body" onClick="PopulateBody()">
</p>
</form>
<form name="eMail" method="post" ENCTYPE="text/plain">
Email Form
<p>Recipient
<input type="text" name="Recipient">
<br>
Subject
<input type="text" name="subject" value="No Subject">
<br>
<textarea name="body" cols="50" rows="10" wrap="OFF"></textarea>
</p>
<p>
<input type="button" name="Submit2" value="Submit" onClick="MailIt()">
</p>
</form>
</body>
</html>