How do I properly use onclink inside Advance PDF/HTML Template?
I have an onclick inside my html tag and when I click on it, it redirect me to another page with an error “Page not found”
I tried using <#function myFunction(){}>
I also used <script>myFunction(){}</Script>
I don’t know what I’m doing wrong.
onclick=”alert(‘This does not work either’)”
I’d be (happily) surprised if this will work through the various layers of NetSuite/ Freemarker and BFO but this looks like it might be worth a read:
https://bfo.com/blog/2011/08/25/using_acrobat_javascript/
Exactly how much of this is supported in NetSuite is probably down to trial and error unfortunately.
N.B. In case you’re not aware, Freemarker is the template engine that takes the template and generates the final content and then BFO is used to turn that into a PDF.
Hi,
Could you please explain what you’re trying to do here? It’s most common to have a link inside a PDF but I can’t think of a reason for any other clickable element.
Thanks,
Chris
I have an img tag with a URL as the scr. It’s an image showing that you can copy, in this case the license code ( ${item.licensecode} ) I am trying to create a function to copy the license code to the user’s clipboard. but I can’t even get an alert() to work.
Hi Chris,
I was able to test out the BFO but it was not working for me. I tried different ways and even implemented exactly what was shown.
I am aware of Freemarker, and this works for me but I couldn’t get the function side working either.
Thanks for your input, I really appreciate it. I will have to stop working on this since it’s just a nice to have, not mandatory.
Thank You.
To create an onclick event in your HTML code, use the onclick attribute within an HTML element.
For example, you can use <element onclick=”myFunction()”> to trigger the JavaScript function myFunction() when the element is clicked.
Make sure to define the myFunction JavaScript function correctly using the <script> tag in your HTML document.
If you encounter a “Page not found” error, it’s likely unrelated to the JavaScript code and may be due to issues with the URL or page structure, so verify the URL and placement of your code within the HTML document for accuracy.



