But in some of the versions of dmxAppConnect.js that I’m trying for AC2, the following button causes get_contact_activity.submit() to execute once when I mouse click on it, and in other versions it fires twice and triggers an abort event on the first firing:
My rule of thumb, I don’t hook events in the submit button, but rather the server connect form element. I believe I hook a Dynamic Event “on form submit” (or similar), and I might (not too sure) also have a preventDefault modifier to such form so the custom steps can run instead of the default SC form behaviour
The only way i can make this happen is to have both on click and on keydown.enter events both submit the form and then this happens when i hit the enter button, when the button is focused.
And this happens in both beta and stable, the keydown event here looks wrongly added to me, you don’t need it. The onclick event will run fine when the button is focused and the enter is pressed.
I would remove the keydown event, when the button has focus and the enter or spacebar is pressed it will trigger the click event, no need to also listen for the key (this will only cause both event handlers to run).
Just and advice here - even if now it works for you by chance, (as in my tests it always submits twice on hitting enter), now it’s the time to embrace the best practices and remove the unnecessary enter event.