Forum Discussion
Storyline / Javascript Help
Hi Jason
Did you fix the other problem?? When I tested your code, I got it to read the pdf template from the root ditectory - but you then get the second error message I posted. Although this message says "Failed to load pdf document" that's because your error handling code says that for ALL errors!
The error is actually that you are passing a null value in your "setText" command. You need to check if the user doesn't provide a response.
Try running your app and when you get to the screen with the JavaScript open the browser debug sceen ( F12) in Microsoft Edge. you can then select "console" and you will be able to see actual error (as my post above)
Good luck
- JasonHalterman4 months agoCommunity Member
We're getting there!
1 - Uploading it to our website as a PDF fixed one issue
2 - Went through all of my variables to ensure there's no null entries (realized there were two "TextEntry" variables used zero times in Storyline. That fixed the other error. Now I'm getting this one:
actionator::exeJavaScript - Script1 is not defined
Using this code for downloading:
//Save form
const pdfBytes = await pdfDoc.save();
//Download the form
await import('https://unpkg.com/tiny-save-as/dist/tiny-save-as.esm.js')
.then(({default: saveAs}) => {
const blob = new Blob([pdfBytes], {type: 'application/octet-stream'});
saveAs(blob, filename);
})
.catch((err) => {
console.log(err);
});
}I have a screenshot attached and a text document of the entire Javascript code. I cannot thank you enough for helping thus far, and if you can push me over the finish line I will be eternally grateful!