how to trigger JavaScript within form fields while populating pdf form

I have created pdf form. Some of the fields in this form contain JavaScript. As filling the pdf form is a frequent requirement, i am in the process of integrating it with my web application. This involves populating the pdf form with content from my web database. My developer has been successful in doing so with PDF-LIB. But the issue is with the fields with JavaScript. The JavaScript is not triggered until the pdf file is edited manually. If the pdf form is populated and encrypted with PDF-LIB and is ready for download (which is how i want it to work), the JavaScript is not triggered and the fields with JavaScript fail to work.
What would be the easiest way to trigger JavaScript in the pdf form whilst it is populated? I would like to automate this task aswell or it would defeat my purpose of shifting from manual workflow to automated.
My developer has opted for PDF-LIB mostly because it is compatible with the node js which he is using to build the web app. Or Maybe there are other options available to get this work done?
Can the expert members here please guide me through this