Help with JavaScript: Group multiple text variables and send it as an email
Oct 06, 2022
Hi everyone,
I have 7 slides in this course, each slide has one text input and a text variable to store this input.
In the last slide, display all 7 text variables to users, and let users send all text as an email.
I got everything working except for two bugs:
1. The default email client on my computer does not fire up if I write too many words, no matter if it's in one variable or spread words to multiple variables, maybe around 2500 characters. Does the variable have character limit?
Code below:
var player = GetPlayer();
var useremail=player.GetVar("Email");
var note1=player.GetVar("note1");
var note2=player.GetVar("note2");
var note3=player.GetVar("note3");
var note4=player.GetVar("note4");
var note5=player.GetVar("note5");
var note6=player.GetVar("note6");
var note7=player.GetVar("note7");
var subject="Questions";
var questions=note1+note2+note3+note4+note5+note6+note7;
var content="Hi,%0d%0A%0d%0A";
content+=questions;
var mailto_link='mailto:'+useremail+'?subject='+subject+'&body='+content;
win=window.open(mailto_link,'emailWin');
2. There is no line break between variables in the email body. Perhaps we have to rely on users to hit extra enter.
https://360.articulate.com/review/content/46b10788-a4a2-4abd-9b20-fb1899ab4451/review
Thanks a lot!
6 Replies
Hi Tianxuan Liu, I made a few adjustments to your code in your SL file and now its working as per your requirements. Review, and let me know if you still require assistance.
Thanks, Sandeep.
The code doesn't work.
First, the body text goes to the subject line of the email. 〒▽〒
Second, the SEND EMAIL button doesn't fire up the default email client on my computer If I write too many words.
For example, copy the below lorem into questions 1 and 2. Go to the last slide, click on send email, and my outlook will start.
But copy more lorem to questions 3 and 4, go to the last slide, no response from send email button. I just don't understand this.
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Hi Sandeep,
I modified your code. The email subject and body are working now. The linebreak in the email is also working, thank you.
The linebreak on the "COPY" function doesn't work. I don't worry about it right now.
Now I am going to see why Outlook doesn't start up.
Thanks, Sandeep.
I submitted a support case about Outlook won't start to Articulate, will post their response here later.
Hi Tianxuan!
Thanks so much for reaching out.
I see that you've opened a case and you're working with my colleague Lianne. Great call, you're in good hands!
We'll continue the conversation over in the support case.
Have a great day and happy developing! ✨