JavaScript help
Aug 28, 2019
Hello,
I am very new to JavaScript but I was able to develop a code that generates an email with answers from surveys throughout the course for the user to email the answers to themselves. However, there are no spaces between the answers when the email is generated. Is there a way to space out the answers or maybe number them?
Here is my code
var email="";
var player = GetPlayer();
var subject="Your Wellness Goals";
var body_start=player.GetVar("NumericEntry");
var TextEntry = player.GetVar("TextEntry");
var TextEntry1 = player.GetVar("TextEntry1");
var TextEntry3 = player.GetVar("TextEntry3");
var TextEntry4 = player.GetVar("TextEntry4");
var TextEntry5 = player.GetVar("TextEntry5");
var TextEntry6 = player.GetVar("TextEntry6");
var TextEntry7 = player.GetVar("TextEntry7");
var TextEntry9 = player.GetVar("TextEntry9");
var TextEntry10 = player.GetVar("TextEntry10");
var TextEntry8 = player.GetVar("TextEntry8");
body_text = body_start;
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_text+" "+TextEntry+TextEntry1+TextEntry3+TextEntry4+TextEntry5+TextEntry6+TextEntry7+TextEntry9+TextEntry10+TextEntry8;
win=window.open(mailto_link,"emailWin");
Would appreciate any help!
Sofia
2 Replies
you need to add " " between each answer e.g. textEntry1 + " " + textEntry2 etc
Your textentrys are basically strings, so just add TextEntry1+"\n"+TextEntry2 and it should work.
This discussion is closed. You can start a new discussion or contact Articulate Support.