Javascript - send text box entry to body text of email

Nov 15, 2021

Hi all,

I want to use Javascript so that when a learner clicks "Submit," their email opens with their email address filled in, and the text entry contents to be in the body of the email.

I can open an email with a predetermined email address, subject and body text, but I'm struggling to populate the variables. My Javascript doesn't work when I call the Player.

My project is attached. Thanks!!

2 Replies
Molly Fisher

Replying to myself because I worked out an almost solution:

var player = GetPlayer();
var email=player.GetVar("tomail");
var subject=player.GetVar("subject");
var bodytxt=player.GetVar("Goals");
var start = player.GetVar("body_start");

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+start+bodytxt+"%0d%0A";

win=window.open(mailto_link,'emailWin');

 

So I can successfully populate the variables! But now my issue is to create a page break after the body_start text.