How to (correctly) include JavaScript to a button click on a custom screen?

  • 11 November 2022
  • 1 reply

Userlevel 1

I need to add JavaScript code to run when a button is clicked on a screen I’m including through a Customization Project. (I’m using Acumatica 2022 R1)

I am able to do it by including a function using the JavaScript control, and then calling it from the Click or MouseDown inside the ClientEvents menu on the button’s properties.

I can also do it by entering the JavaScript code directly into the Click or MouseDown events.

I can confirm the JavaScript code runs, but the problem is that it runs when the screen is loaded, instead of when the button is clicked. Also, the code runs twice for some reason.

I was wondering if this may be caused by not following a right way to include JavaScript. I’d like to know what steps need to be followed if this is the case, or to learn from any suggestions any of you may have tried already to make JavaScript code work correctly on a button click.


Best answer by Loodt 22 February 2023, 13:45

View original


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved