Forum Discussion
Using Code block for reflection - unable to print
Hi everyone,
Trying out the code block with some help from my coder colleague. We created this html and it works great in chrome if I just launch it.
I paste it into the code block for RISE and the download button will not work. Any coders (I am not one) have thoughts?
this is what happens in RISE
https://360.articulate.com/review/content/8445e878-246b-4980-b2b6-33216b6c313d/review
I have also attached the code if you launch in Chrome it works as expected.
7 Replies
- TeresaVanderposCommunity Member
I keep trying to add the .txt file it shows success, but not seeing it, please let me know if you can see the code attachment file.
- Chris-HurstCommunity Member
I had issues around this too, so ended up using JavaScript in a Storyline block, then embedding this Storyline block in Rise. This code downloads a Word doc with the users comments, here's the code, I hope it helps!
// === STORYLINE: SAVE THIS BLOCK'S 5 ENTRIES TO LOCALSTORAGE === var player = GetPlayer(); // Give this Storyline block a unique part id: var partId = "Design"; // change in each embedded Storyline: part-1, part-2, ... // Fill in the 5 prompts and the corresponding Storyline variable names for THIS block // (Use your exact on-screen copy as labels, and exact variable names) var fields = [ { label: "Write clear learning objectives", value: player.GetVar("Entry_Analyse") || player.GetVar("D1TextEntry1") || "" }, { label: "Choose format (course, workshop, job aid, etc.)", value: player.GetVar("Entry_Design") || player.GetVar("D1TextEntry2") || "" }, { label: "Map content flow (topics in order)", value: player.GetVar("Entry_Develop") || player.GetVar("D1TextEntry3") || "" }, { label: "Select active learning methods", value: player.GetVar("Entry_Implement")|| player.GetVar("D1TextEntry4")|| "" }, { label: "List supporting media", value: player.GetVar("Entry_Evaluate")|| player.GetVar("D1TextEntry5") || "" } ]; // Optional: include a short title for this block (e.g., "Analyse", "Design", etc.) var blockTitle = "Design"; // Save payload var payload = { id: partId, title: blockTitle, savedAt: new Date().toISOString(), fields: fields }; // Use a shared collection key in localStorage var KEY = "RiseCombinedNotes__parts"; var parts = []; try { parts = JSON.parse(localStorage.getItem(KEY) || "[]"); } catch(e){ parts = []; } // Replace if this part already exists; otherwise append var idx = parts.findIndex(p => p && p.id === partId); if (idx >= 0) { parts[idx] = payload; } else { parts.push(payload); } // Persist localStorage.setItem(KEY, JSON.stringify(parts)); // (Optional) quick feedback back into Storyline via a variable: try { player.SetVar("NotesSavedOK", true); } catch(e) {}
- TeresaVanderposCommunity Member
Hi Chris, thank you. Funny thing this is how I do it now...but I now really wanted to save time and not have to build in Storyline... thank you for the code though, I will hold on to it as I will be curious of how it may work differently from mine. Just to share here is a copy of my code from storyline that I use and how when executed will open up a window to select a button to print notes. And a sample storyline file (not using this code but an example)
Hmmm why in the community can I not upload a .txt file. I tried to send to you.
But either way this storyline file has a basic example of what I do now.
- TeresaVanderposCommunity Member
Just figured out how to add my code thanks IvanGroe
This is my code that I want to tweak to be able to print
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Text Input Activity</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Open Sans', sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; } .container { background: #F1EAF4; border-radius: 5px; padding: 40px; max-width: 700px; width: 100%; } .question-section { margin-bottom: 30px; } h2 { color: #6E298D; margin-bottom: 15px; font-size: 2em; } .question-text { color: #333; font-size: 1.063em; line-height: 1.6; margin-bottom: 20px; } .input-section { margin-bottom: 25px; } label { display: block; color: #555; font-weight: 600; margin-bottom: 10px; font-size: 1em; } textarea { width: 100%; min-height: 150px; padding: 15px; font-size: 1em; font-family: inherit; border: 2px solid #e0e0e0; border-radius: 5px; resize: vertical; transition: all 0.3s ease; } textarea:focus { outline: none; border-color: #6E298D; box-shadow: 0 0 0 3px rgba(110, 41, 141, 0.1); } .char-count { text-align: right; color: #999; font-size: 0.9em; margin-top: 5px; } .button-container { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; } button { flex: 1; padding: 15px 30px; font-size: 1em; font-weight: bold; border: none; border-radius: 5px; cursor: pointer; background-color: #6E298D; color: white; transition: background-color 0.2s ease; } /* Remove shadows and animations */ .btn-reveal:hover, .btn-copy:hover { background-color: #5b2076; transform: none; box-shadow: none; } .btn-reveal:disabled, .btn-copy:disabled { opacity: 0.5; cursor: not-allowed; } .answer-section { background: #f8f9ff; border-left: 4px solid #6E298D; padding: 25px 25px 30px 25px; border-radius: 5px; margin-top: 25px; display: none; animation: slideDown 0.4s ease; } .answer-section.show { display: block; } @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } } /* FIXED SPACING BELOW */ .answer-content h2 { margin-bottom: 15px; color: #6E298D; } .answer-content p { margin-bottom: 18px; line-height: 1.7; color: #444; } .answer-content ul { margin: 15px 0 20px 25px; padding-left: 15px; } .answer-content li { margin-bottom: 10px; } .note { background: #fff9e6; border-left: 4px solid #ffc107; padding: 15px; border-radius: 5px; margin-top: 20px; font-size: 0.95em; color: #666; } .note strong { color: #333; } #copyMsg { font-size: 0.95em; color: #333; margin-top: 10px; padding: 10px; border-radius: 5px; } </style> </head> <body> <div class="container"> <div class="question-section"> <h2>Reflection Activity</h2> <div class="question-text"> <strong>Question:</strong> What topics would you cover when discussing confidentiality with youth? </div> </div> <div class="input-section"> <label for="userInput">Your Response:</label> <textarea id="userInput" placeholder="Type your answer here..." maxlength="1000" ></textarea> <div class="char-count"> <span id="charCount">0</span> / 1000 characters </div> </div> <div class="button-container"> <button class="btn-reveal" id="revealBtn" onclick="toggleAnswer()"> Show Feedback </button> <button class="btn-copy" id="copyBtn" aria-label="Copy your response and feedback to clipboard"> Copy Feedback to Clipboard </button> </div> <div id="copyMsg" role="status" aria-live="polite"></div> <div class="answer-section" id="answerSection"> <div class="answer-content" id="answerContent"> <h2>Feedback</h2> <p>During the first session with a young patient, the clinician must obtain informed consent from them to proceed with the interview. The clinician can begin by explaining that the conversation will take place between just the two of them and that anything the youth tells the clinician will remain private.</p> <p>The clinician should also explain that although personal health information cannot be disclosed without the patient's consent, there are certain situations in which they may need to breach confidentiality. The College of Physicians and Surgeons of Ontario (2024) lists the following situations in which physicians have a duty to report:</p> <ul> <li>Report to the Children’s Aid Society when there is a risk of or experience of abuse or neglect in a child under age 16.</li> <li>Report to police if there are reasonable grounds that disclosure is necessary to eliminate/reduce significant and imminent risk of serious harm to a person or group of people.</li> <li>Report to the Ministry of Transportation if a patient aged 16 or older has a medical condition or impairment that may make it dangerous to drive (e.g., substance use disorder).</li> </ul> <p>In this conversation, the clinician can also obtain consent to include a parent or other caregiver in certain parts of the appointment.</p> <p>Physicians must be aware of their province's or jurisdiction’s policies for protecting patient health information because they may vary.</p> </div> </div> <div class="note"> <strong>💡 Tip:</strong> Try writing your own response before viewing the suggested answer. There's no single "correct" answer – this is about reflecting on your own knowledge and comparing it with other perspectives. </div> </div> <script> const userInput = document.getElementById('userInput'); const charCount = document.getElementById('charCount'); const revealBtn = document.getElementById('revealBtn'); const answerSection = document.getElementById('answerSection'); const answerContent = document.getElementById('answerContent'); const copyBtn = document.getElementById('copyBtn'); const copyMsg = document.getElementById('copyMsg'); let answerRevealed = false; // Character counter userInput.addEventListener('input', function() { charCount.textContent = this.value.length; }); // Toggle feedback visibility function toggleAnswer() { answerRevealed = !answerRevealed; if (answerRevealed) { answerSection.classList.add('show'); revealBtn.textContent = 'Hide Feedback'; } else { answerSection.classList.remove('show'); revealBtn.textContent = 'Show Feedback'; } } // Clipboard copy handler (Rise-safe) copyBtn.addEventListener('click', function() { const userText = userInput.value.trim(); const feedbackText = answerContent.innerText.trim(); const questionText = 'What topics would you cover when discussing confidentiality with youth?'; const content = `REFLECTION ACTIVITY FEEDBACK ======================================== QUESTION: ${questionText} YOUR RESPONSE: ${userText || "(No response entered)"} ---------------------------------------- SUGGESTED FEEDBACK: ${feedbackText} ======================================== Copied: ${new Date().toLocaleString()} `; if (navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(content).then(() => { showCopyMessage("✅ Your response and feedback have been copied! You can now paste into a document to save it."); }).catch(() => { fallbackCopy(content); }); } else { fallbackCopy(content); } }); // Fallback method for Rise 360 function fallbackCopy(text) { const textArea = document.createElement("textarea"); textArea.value = text; textArea.style.position = "fixed"; textArea.style.opacity = "0"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { const successful = document.execCommand('copy'); if (successful) { showCopyMessage("✅ Your response and feedback have been copied! You can now paste into a document to save it."); } else { showCopyMessage("❌ Copy failed. Please select and copy manually."); } } catch (err) { showCopyMessage("❌ Copy not supported. Please select and copy manually."); } document.body.removeChild(textArea); } // Display message function showCopyMessage(msg) { copyMsg.innerText = msg; copyBtn.textContent = "✅ Copied!"; setTimeout(() => { copyBtn.textContent = "Copy Feedback to Clipboard"; }, 2000); } </script> </body> </html> - TeresaVanderposCommunity Member
Hmmm my last post did not save. I wanted to post the code that I couldn't before and thanks to IvanGroe for helping.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Text Input Activity</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Open Sans', sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; } .container { background: #F1EAF4; border-radius: 5px; padding: 40px; max-width: 700px; width: 100%; } .question-section { margin-bottom: 30px; } h2 { color: #6E298D; margin-bottom: 15px; font-size: 2em; } .question-text { color: #333; font-size: 1.063em; line-height: 1.6; margin-bottom: 20px; } .input-section { margin-bottom: 25px; } label { display: block; color: #555; font-weight: 600; margin-bottom: 10px; font-size: 1em; } textarea { width: 100%; min-height: 150px; padding: 15px; font-size: 1em; font-family: inherit; border: 2px solid #e0e0e0; border-radius: 5px; resize: vertical; transition: all 0.3s ease; } textarea:focus { outline: none; border-color: #6E298D; box-shadow: 0 0 0 3px rgba(110, 41, 141, 0.1); } .char-count { text-align: right; color: #999; font-size: 0.9em; margin-top: 5px; } .button-container { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; } button { flex: 1; padding: 15px 30px; font-size: 1em; font-weight: bold; border: none; border-radius: 5px; cursor: pointer; background-color: #6E298D; color: white; transition: background-color 0.2s ease; } /* Remove shadows and animations */ .btn-reveal:hover, .btn-copy:hover { background-color: #5b2076; transform: none; box-shadow: none; } .btn-reveal:disabled, .btn-copy:disabled { opacity: 0.5; cursor: not-allowed; } .answer-section { background: #f8f9ff; border-left: 4px solid #6E298D; padding: 25px 25px 30px 25px; border-radius: 5px; margin-top: 25px; display: none; animation: slideDown 0.4s ease; } .answer-section.show { display: block; } @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } } /* FIXED SPACING BELOW */ .answer-content h2 { margin-bottom: 15px; color: #6E298D; } .answer-content p { margin-bottom: 18px; line-height: 1.7; color: #444; } .answer-content ul { margin: 15px 0 20px 25px; padding-left: 15px; } .answer-content li { margin-bottom: 10px; } .note { background: #fff9e6; border-left: 4px solid #ffc107; padding: 15px; border-radius: 5px; margin-top: 20px; font-size: 0.95em; color: #666; } .note strong { color: #333; } #copyMsg { font-size: 0.95em; color: #333; margin-top: 10px; padding: 10px; border-radius: 5px; } </style> </head> <body> <div class="container"> <div class="question-section"> <h2>Reflection Activity</h2> <div class="question-text"> <strong>Question:</strong> What topics would you cover when discussing confidentiality with youth? </div> </div> <div class="input-section"> <label for="userInput">Your Response:</label> <textarea id="userInput" placeholder="Type your answer here..." maxlength="1000" ></textarea> <div class="char-count"> <span id="charCount">0</span> / 1000 characters </div> </div> <div class="button-container"> <button class="btn-reveal" id="revealBtn" onclick="toggleAnswer()"> Show Feedback </button> <button class="btn-copy" id="copyBtn" aria-label="Copy your response and feedback to clipboard"> Copy Feedback to Clipboard </button> </div> <div id="copyMsg" role="status" aria-live="polite"></div> <div class="answer-section" id="answerSection"> <div class="answer-content" id="answerContent"> <h2>Feedback</h2> <p>During the first session with a young patient, the clinician must obtain informed consent from them to proceed with the interview. The clinician can begin by explaining that the conversation will take place between just the two of them and that anything the youth tells the clinician will remain private.</p> <p>The clinician should also explain that although personal health information cannot be disclosed without the patient's consent, there are certain situations in which they may need to breach confidentiality. The College of Physicians and Surgeons of Ontario (2024) lists the following situations in which physicians have a duty to report:</p> <ul> <li>Report to the Children’s Aid Society when there is a risk of or experience of abuse or neglect in a child under age 16.</li> <li>Report to police if there are reasonable grounds that disclosure is necessary to eliminate/reduce significant and imminent risk of serious harm to a person or group of people.</li> <li>Report to the Ministry of Transportation if a patient aged 16 or older has a medical condition or impairment that may make it dangerous to drive (e.g., substance use disorder).</li> </ul> <p>In this conversation, the clinician can also obtain consent to include a parent or other caregiver in certain parts of the appointment.</p> <p>Physicians must be aware of their province's or jurisdiction’s policies for protecting patient health information because they may vary.</p> </div> </div> <div class="note"> <strong>💡 Tip:</strong> Try writing your own response before viewing the suggested answer. There's no single "correct" answer – this is about reflecting on your own knowledge and comparing it with other perspectives. </div> </div> <script> const userInput = document.getElementById('userInput'); const charCount = document.getElementById('charCount'); const revealBtn = document.getElementById('revealBtn'); const answerSection = document.getElementById('answerSection'); const answerContent = document.getElementById('answerContent'); const copyBtn = document.getElementById('copyBtn'); const copyMsg = document.getElementById('copyMsg'); let answerRevealed = false; // Character counter userInput.addEventListener('input', function() { charCount.textContent = this.value.length; }); // Toggle feedback visibility function toggleAnswer() { answerRevealed = !answerRevealed; if (answerRevealed) { answerSection.classList.add('show'); revealBtn.textContent = 'Hide Feedback'; } else { answerSection.classList.remove('show'); revealBtn.textContent = 'Show Feedback'; } } // Clipboard copy handler (Rise-safe) copyBtn.addEventListener('click', function() { const userText = userInput.value.trim(); const feedbackText = answerContent.innerText.trim(); const questionText = 'What topics would you cover when discussing confidentiality with youth?'; const content = `REFLECTION ACTIVITY FEEDBACK ======================================== QUESTION: ${questionText} YOUR RESPONSE: ${userText || "(No response entered)"} ---------------------------------------- SUGGESTED FEEDBACK: ${feedbackText} ======================================== Copied: ${new Date().toLocaleString()} `; if (navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(content).then(() => { showCopyMessage("✅ Your response and feedback have been copied! You can now paste into a document to save it."); }).catch(() => { fallbackCopy(content); }); } else { fallbackCopy(content); } }); // Fallback method for Rise 360 function fallbackCopy(text) { const textArea = document.createElement("textarea"); textArea.value = text; textArea.style.position = "fixed"; textArea.style.opacity = "0"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { const successful = document.execCommand('copy'); if (successful) { showCopyMessage("✅ Your response and feedback have been copied! You can now paste into a document to save it."); } else { showCopyMessage("❌ Copy failed. Please select and copy manually."); } } catch (err) { showCopyMessage("❌ Copy not supported. Please select and copy manually."); } document.body.removeChild(textArea); } // Display message function showCopyMessage(msg) { copyMsg.innerText = msg; copyBtn.textContent = "✅ Copied!"; setTimeout(() => { copyBtn.textContent = "Copy Feedback to Clipboard"; }, 2000); } </script> </body> </html> - TeresaVanderposCommunity Member
My post won't save when I add html code.
Hi TeresaVanderpos,
Thanks so much for sharing your code! It looks like your post was briefly held by our automatic filters, but it’s visible now. We really appreciate you taking the time to post such a detailed example, this will be a helpful reference for others exploring custom code approaches in Rise 360.
Glad to have your contribution in the community.
Related Content
- 3 months ago
- 3 months ago
- 10 months ago
- 11 months ago