Javascript addeventlistner for Save button?

0
Hi, I would like to run a java function when I press save in a datagrid. However document.getElementById("buttonname") function dont seems to work. Any other ideas ?    Kr Thomas
asked
3 answers
1

If you need to call a Java action, could you not just add a button to trigger a microflow that will call the Java action and save the data?

https://docs.mendix.com/refguide/button-widgets

answered
0

I think you are mixing up Java and JavaScript hence we can’t properly help you. If I look at your question it seems you want to trigger some functionality  on click of a button. You can trigger JavaScript via a JavaScript action in a nanoflow or Java via a Java action with a microflow.

Could you share your real use case? What are you trying to achieve?

answered
0

I have some javascript code in a Javascript snippet that I want to execute when the Save button is pressed.

However the Javascript snippet is not trigged by the Save button event.

 

Javascript code within the snippet:

document.addEventListener("myBtn", function(event) {

this._contextObj.set('Weight', 2);

});

 

answered