Forum Discussion

SevanaMonti-3f1's avatar
SevanaMonti-3f1
Community Member
2 years ago

Javascript Email Assistance Please

Hi team,

Hoping someone may be able to assist me with some javascripting edits.

I have set up some script so that the inputs made throughout the course can be emailed at the end. All is working as expected, however the email is not pretty at all. Hoping someone may be able to help remove the extra commas that appear and possibly have everything appear on separate lines in the email, rather than one string. 

For more background, the learners can select from three options, and add commentary, they are then presented with another three options, and another three options.

So 3 comments collected in total, but 9 potential different options. 

Here is the script, and a screenshot attached. :)

----------

 

var player = GetPlayer();
var email=player.GetVar("communityexperience@brisbane.qld.gov.au");
var email_address = "communityexperience@brisbane.qld.gov.au";
var subject="Our Community Experience Responses";
var body_start=new Array("By clicking send, you will be providing the following to the Community Experience team:");
body_start[1]=("    Activity 1 response:    ");
body_start[3]=player.GetVar('Activity1_CareResponseBox');
body_start[4]=player.GetVar('Activity1_CommunityResponseBox');
body_start[5]=player.GetVar('Activity1_ConnectionResponseBox');
body_start[7]=("    Activity 2 response:    ");
body_start[9]=player.GetVar('Activity2_CareResponse');
body_start[10]=player.GetVar('Activity2_CommunityResponse');
body_start[11]=player.GetVar('Activity2_ConnectionResponse');
body_start[13]=("    Activity 3 response:    ");
body_start[15]=player.GetVar('Activity3_CareResponse');
body_start[16]=player.GetVar('Activity3_CommunityResponse');
body_start[17]=player.GetVar('Activity3_ConnectionResponse');
var mailto_link='mailto:'+email_address+'?subject='+subject+'&body='+escape(body_start);
emailwin=window.open(mailto_link,'emailWin');
emailwin=window.close();

 

---------

Thank you in advance for your assistance. 

 

No RepliesBe the first to reply