Send text from Lectora to an email or print friendly page

knorberg
knorberg Community Member Posts: 5
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

Comments

  • carlosru1z
    carlosru1z Community Member Posts: 3
    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
  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    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.
  • carlosru1z
    carlosru1z Community Member Posts: 3
    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.
  • klaatu
    klaatu Community Member Posts: 988
    Create a button and add the following Javascript:

    var email = "[email protected]";
    var subject = "My Notes";
    var body = Var_NoteSummary.getValue();

    window.location.href = "mailto:" + email + "?subject=" + subject +"&body=" +body

    Replace "[email protected]" with the email address you want the information sent to. Replace Var_NoteSummary with whatever lectora variable you have been using to record the notes.

    As info, since you mentioned the Let's Cook sample, I used that to test. _NoteSummary is the variable that holds all the saved notes. If you add a button in the header of the notes object found in popups with the code above, it will open email with the notes summary in the body.

    Of course for this to work the user must have a default email client set up on their computer.

    Hope this helps. Contact me if you have any questions.

    Darrel

    NOTE: If you copy and paste right from this forum you may need to delete and re-add the quotes. For some reason copied quotes are sometimes a problem.

     
  • carlosru1z
    carlosru1z Community Member Posts: 3
    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
  • timk
    timk Community Member Posts: 1,176 ☆ Superstar ☆
    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
  • knorberg
    knorberg Community Member Posts: 5
    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.
  • timk
    timk Community Member Posts: 1,176 ☆ Superstar ☆
    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
  • knorberg
    knorberg Community Member Posts: 5
    Thank you so much for shareing:-)

    K
  • wzimmerman1834
    wzimmerman1834 Community Member Posts: 6
    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:[email protected]";

    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?
  • klaatu
    klaatu Community Member Posts: 988
    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
  • wzimmerman1834
    wzimmerman1834 Community Member Posts: 6
    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:[email protected]?subject=email test&body=stuff the user wrote.";

    But once we try to grab the contents of the text field like this:

    var body = Var_NoteSummary.getValue();

    window.location.href = "mailto:[email protected]?subject=email test&body=" + body;

    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
  • klaatu
    klaatu Community Member Posts: 988
    It might be easier if you can either post a sample of what you have, or if you prefer, you can email me at [email protected] and I will take a look.
  • wzimmerman1834
    wzimmerman1834 Community Member Posts: 6
    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
  • klaatu
    klaatu Community Member Posts: 988
    var email = "[email protected]";
    var subject = "My Email";
    var body = Varvar_entry1.getValue();

    window.location.href = "mailto:" + email + "?subject=" + subject +"&body=" +body;

    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
  • wzimmerman1834
    wzimmerman1834 Community Member Posts: 6
    Thank you Darrel,

    That worked great. I really appreciate your willingness to help and point us in the right direction.

    Warren
  • klaatu
    klaatu Community Member Posts: 988
    You're welcome. Glad I was able to help. Anytime.
  • brandic
    brandic Community Member Posts: 11
    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!
  • timk
    timk Community Member Posts: 1,176 ☆ Superstar ☆
    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.
  • nwilliams3743
    nwilliams3743 Community Member Posts: 74
    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/

     

    Thanks
  • nwilliams3743
    nwilliams3743 Community Member Posts: 74
    bump.

    Hoping someone can assist to have each entry added to a new line in the email?
  • timk
    timk Community Member Posts: 1,176 ☆ Superstar ☆
    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 "<br>". For the email you can try to directly add "<br>" where you want to have a break or replace "\r" with "<br>" with javascript before you tranfer it to the "mailto:" command.
Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!