emailing results
Hi all,
I have searched the forums and got some great answers for the above. Managed to achieved the result where:
an email is generated to the correct person
subject line populated
body of the email contains the txt and the score of the test using the code below: (from the forums here)
var player = GetPlayer();
var course="email test0.1"
var email=player.GetVar("emailAddress");
var score=player.GetVar("finalresult");
var subject="using strata";
var body_start="I've completed the course 1 with a score of ";
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start+score
win=window.open(mailto_link, 'emailWin');
BUT
I just can't seem to get it to display a percentage sign at the end of the score?
It shows "I've completed the course 1 with a score of 87" all I want is a % symbol at the end!
Can anybody help?
10 Replies
Try changing var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start+score
to
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start+score + " %"
Hi Michael,
Tried that one - no joy :o(
Also tried -
var body_percent=" %";
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start+score+body_percent
score+”\%”
Hi all,
Managed to get it to do what I wanted! Thanks to those people whose bits fo Java I have used to create this! It will now open an email, populate the 'To:' and 'Subject:' fields and fill in the body with multiple quiz results, WITH a % sign at the end and a final result
var player = GetPlayer();
var course="email test0.1"
var email=player.GetVar("emailAddress");
var score1=player.GetVar("ResultQ");
var score2=player.GetVar("ResultM");
var score3=player.GetVar("ResultMP");
var score4=player.GetVar("finalresult");
var subject="Using Strata e-learning";
var body_start="I've completed the Using Strata e-learning. My scores for each of the modules are:\n\r";
var body_one="Quotes and New Business: ";
var body_two="\n\rMTA and Cancellations: ";
var body_three="\n\rManage Policy: ";
var body_final="\n\rOverall Result: ";
var body_end= "%";
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(body_start)+(body_one)+score1+encodeURIComponent(body_end)+encodeURIComponent (body_two)+score2+encodeURIComponent(body_end)+encodeURIComponent (body_three)+score3+encodeURIComponent(body_end)+encodeURIComponent (body_final)+score4+encodeURIComponent(body_end)
win=window.open(mailto_link, 'emailWin');
This looks great...I wonder if you could provide an example of this in a .story file?
Thanks for sharing Eric!
Hi John
Here goes! Oh the questions are just temporary ones! lol
Thanks....
Thanks again Eric! John, I hope this helps you out with what you are trying to accomplish.
I feel really dumb, but I see a lot of programming in the above conversations. Where am I able to go in and enter this coding?
Hi Clint! I'm not going to pretend that I would be a good assist here, but if you check out the .story file that Eric shared above you can see his coding. Slide 1.14 may help you get started