html generated email...body won't work.

The body of this email is not working.  What am I doing wrong?

Email: <input type="text" id="email"></input><br>
    Subject: <input type="text" id="subject"></input><br>
    Body: <input type="text" id="comment"></input><br>
    <button onclick="myFunction()">Review Before Sending</button>

    <p id="demo"></p>

    <script>
      function myFunction() {
        var input = document.getElementById('email');
        email = input.value;
        var input = document.getElementById('subject');
        subject = input.value;
		var input = document.getElementById('comment');
        subject = input.value;

        window.location.href = "mailto:" + email + "?subject=" + subject + "&body=" + comment;
      }
    </script>

Open in new window

smitty62Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
you email client may not allow to run javascript which should be the case for security purpose
0
smitty62Author Commented:
The code below works, but I need to get the body (input fields)  inserted. How do I create a string field variable then use that variable in the "action=" option.

<form style="text-align:left; margin:5%"  action="mailto:doi.webmaster@illinois.gov?subject=Test_Mail" method="post" enctype="text/plain">
Name: <input type="text" name="name"><br>
org: <input type="text" name="org"><br>
Comment: <input type="text" name="comment" size="50"><br><br>
<input type="text" name="string"><br>
<input type="submit" value="Send"> <input type="reset" value="Reset">
</form>

Open in new window

0
smitty62Author Commented:
okay, I've been working on this, and so far this is what I have, however the variable is not be recognized by the "action="

I've seen other code snippets out there using a variable in this way, but I can't get it to work.

<form style="text-align:left; margin:5%"  action="stringer" method="post" enctype="text/plain">
Name: <input type="text" name="name"><br>
Organization: <input type="text" name="org"><br>
Comment: <input type="text" name="comment" size="50"><br><br>
<input type="text" name="string"><br>
<input type="submit" value="Send"> <input type="reset" value="Reset">
</form>

<script>
				      function myFunction() {
						var input = document.getElementById('name');
				        email = input.value;
				        var input = document.getElementById('org');
				        subject = input.value;
					    var input = document.getElementById('comment');
				        subject = input.value;
					    var stringer = "mailto:doi.webmaster@illinois.gov?subject=Test_Mail&body=" + name + " - " + org + " - " + comment;
      				  }
    			    </script>

Open in new window

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

smitty62Author Commented:
This is working, however a null is getting inserted into the variables for some reason.

 <script type="text/javascript">
				      function myFunction() {
						alert("alert message1");
						var name1 = document.getElementById('name');
						alert(name1);
				        var org1 = document.getElementById('org');
						alert(org1);
					    var comment1 = document.getElementById('comment');
						alert(comment1);
					    window.location.href = "mailto:doi.webmaster@illinois.gov?subject=Test_Mail&body=" + name1 + " - " + org1 + " - " + comment1;
      				  }
    			    </script>

Open in new window


<form style="text-align:left; margin:5%"  action="stringer" method="post" enctype="text/plain">
Name: <input type="text" name="name"><br>
Organization: <input type="text" name="org"><br>
Comment: <input type="text" name="comment" size="50"><br><br>
<button onClick="myFunction()">Review your comment</button>
<!-- <input type="submit" value="Send"> <input type="reset" value="Reset"> -->
</form>

Open in new window

0
NorieAnalyst Assistant Commented:
Shouldn't you be using getElementsByName or adding appropriate id attributes to your input elements?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
smitty62Author Commented:
I think your right about that.  I think that's for .net not html.  I was hoping to use fill in boxes then setup in a form, then with javascipt move that information in to the href mailto: statement using a variable, however, the user decided on something else and we will be using survey monkey to collect the data instead.

Thank you for help.
0
smitty62Author Commented:
thank you for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.