Send text from Lectora to an email or print friendly page
November 27, 2014 12:00 AM
Hi,
can anyone help me with my issue on sending text from Lectora to email/print friendly page.
I'm developing a course with a note book functionality (like the functionality from the lets' cook course), and what I want is for the learner to collect, save, print or email a summary of his/her notes in the course.
What I have tried to do:
Every time the learner click an add note button, the text from the free text field is added to a variable.
A summary of all texts is shown in a Note summary page.
Then I would like to print or send this text by email. The Print functionality in Lectora is only printing a screen dump, and miss out the text witch is "hidden" behind the scroll bar.
When sending the variable to an email, it doesn't look nice, without any line breaks.
Do I need to use JavaScript, which I know nothing about, or is there an other solution?
I appreciate any suggestions to solve this.
Kristine
Discussion (22)
This sounds like something you'd need to achieve using some additional scripting. I'll ask a couple people to see if they have suggestions.
Did anyone find a solution to this issue?
I have a very similar problem. I'm showing a summary of what was offered in the content, and I need to send this text as an email body by pressing a button on the same screen.
Please, any suggestions to solve this?
Thanks in advance,
Carlos
Many thanks Jennifer, I also think I need scripting added to the button but my javascript knowledge is very limited, so I would be grateful for any help.
As a b-plan, I've found a script to select and copy the text (and manually paste it in the email body), but haven't been able to make it run.
Create a button and add the following Javascript:
var email = "someone@someplace.com";
var subject = "My Notes";
var body = Var_NoteSummary.getValue();
window.location.href = "mailto:" + email + "?subject=" + subject +"undefined
Can you elaborate on your question? The way I understand it, that is exactly what Darrel's script is doing. You can use the variable "_NoteSummary" to display the summary in a textfield as well as using it as the email body.
Tim
Thank you very much for your help. I tested the solution described above and worked perfectly, but I have only one last goal to achieve.
My question is, as an evolution of the saved notes solution, how could I make a variable hold a summary text (whick is shown in the last page of the content), in order to send the variable content as an email body when pressing the button?
Thanks in advance,
Carlos
Thank you:-)
If I want a printerfriedly page of the content of the _notesummary variable, do you have any tip regarding script?
Thank you in advance.
A printerfriendly page would just be an otherwise empty page with only a textfield that contains the variable. You can create a page, put a textfield on it and attach an action to it:
On: Page show
Action: Change content
Target: This object
Value: _notesummary
Check the course I've shared:
http://community.trivantis.com/shared-content/breaks-in-variables/
Tim
Hi Warren. Sorry to hear your having difficulties. Try the attached and let me know if you get a better result. If you copy and pasted directly from this forum you need to change the quotation marks.
Darrel
Hello Darrel,
Your post was very exciting when I first saw it, but now that I'm attempting to implement it, it's not working at all.
I've even scaled back to just the most basic javascript not using any variables at all, and it won't open a simple mailto: link. I'm using lectora 11. Screenshots of my setup are attached.
This script:
window.location.href="mailto:myemail@mycompany.com";
Added to a button as a "Run Javascript" action on the button, but nothing is happening. I must be missing a checkbox somewhere? This should be very trivial. I'm testing as a tincan export in scorm cloud and the course is passing and completing, but the javascript refuses to work?


It might be easier if you can either post a sample of what you have, or if you prefer, you can email me at darrel.somoza@elearningcode.com and I will take a look.
Hello Darrel,
Thank you so much for your quick response. So the mailto link is working, but once we add a variable and try to concatenate the javascript string it stops working.
So very cool we can populate a subject and body hard coded into that script, This is working just as you mentioned:
window.location.href = "mailto:myname@mycompany.com?subject=email testundefined
It just stops working all together. That variable is making the mailto: link not activate.
Any idea where we're dropping the ball here? Seems like it should be very straight-forward.
Thank you,
Warren Zimmerman
var email = "lisa.holscher@succeedms.com";
var subject = "My Email";
var body = Varvar_entry1.getValue();
window.location.href = "mailto:" + email + "?subject=" + subject +"undefined
In your sample the entry text was being assigned to var_entry1. The above assigns that Lectora variable to the JavaScript variable body.
Let em know if this works for you.
Darrel
Hello Darrel,
I've attached a zip file with our Lectora attempt included.
I'm wondering if we need to create the mailto: string before the actual href call? Not sure, but once we add the variables to the mailto link it just stops working.
Warren
Thank you Darrel,
That worked great. I really appreciate your willingness to help and point us in the right direction.
Warren
Can anyone help me with a similar issue?
I've set up my training to gather essay responses throughout the course and display them collectively at the end. I'd like to give them the option to email these responses to themselves or their manager. The above solutions don't work because the email address is unknown. Is there a way for me to accomplish this?
Thank you!
You'll need a way to get the email adress, e.g. an input field. Then modify Darrels script to use that instead of the static value:
var email = VarEntry_0001.getValue();
Entry_0001 is the variable of the input field. You may have to replace it in case you already have input fields in your course.
Is it possible to get each entry on a new line in the email?
e.g. Throughout a module, a learner can add notes/questions in an entry field and add to the one variable. Once I follow the instructions in this thread, the values all appear on the one line.
Does each note/question require it's own variable to appear on a new line?
Would essentially want it to look the same as Tim's, however in an email
http://community.trivantis.com/shared-content/breaks-in-variables/
undefined
Thanks
bump.
Hoping someone can assist to have each entry added to a new line in the email?
The sample uses only one variable for all notes. This should be better as you don't know how many comments a user would create. To put each comment into a separate line you'll have to add a break. In the sample I use "\r" for breaks as Lectora doesn't allow html tags. The change contents action replaces "\r" with "undefined" with javascript before you tranfer it to the "mailto:" command.
Discussions have been disabled for this post