Forum Discussion
Keep "Text Entry Field" Line Breaks When Displaying the Variable in a Text Box?
Hi Matthew,
Yes, there is more code, and the variable is called TextEntry.
Here is the (basic) code that I'm using (without the TextEntry.replace string mentioned above).// Step 1. Connect JavaScript to the Storyline variables
var player = GetPlayer();
var TextEntry=player.GetVar("TextEntry");
// Step 2. The HTML Section - with the Storyline variables insertedvar contents = "<html><head></head><body style='font-family: sans-serif; padding: 10px; margin: 0px;'><div style='margin-bottom: 10px; padding-left: 5px'><img style='width: 50%; max-width: 550px;' '></div><div><div style='font-size: 14px; background-color: #efefef; padding: 15px; margin-bottom: 10px; border-radius: 3px;'><h3 style='margin-top: 0px; padding-top: 0px;'>TITLE TEXT</h3><div style='background-color: #ffffff; border-radius: 3px; padding: 15px;'><h3 style='padding-top: 0px; margin-top: 0px;'>Line one text<br>Line 2 text<br>You answered:</h3><p style='padding-left: 0px; margin-top: 1em;'>"+TextEntry+"</p></div></div></div></body></html>";
// Step 3. Open the document window, write the HTML contents, and open the print window
var myWindow = window.open("","Print","width=810,height=610,scrollbars=1,resizable=1");myWindow.document.write(contents);
myWindow.print();
Related Content
- 10 months ago
- 4 months ago