I think the form element is setup to go when the enter key is identified. You could possibly set up a routine to identify any key down/press event and determine if it's an enter key, such as:
function onKeyDown(event) {
// Shift key
if (event.which === 16) { console.log('shift key pressed'); }
else if (event.which === 27) { console.log('escape key pressed');}
else if (event.which === 39 || event.which === 37) {
console.log('arrow keys pressed');
}
else if (event.which === 13) {
// Peform the function that you need, or disregard it.
console.log('Enter key!');
}
}
but this can get ugly, fast.
I would recommend that you don't setup, whatever it is that you are setting up, in a form. Just have the input elements and set up an onclick event for the button to do something at that point. Such as:
btnSubmit = document.getElementById("btnSubmit");
btnSubmit.onclick = function () {
let val1 = document.getElementById("textbox1").value;
let val2 = document.getElementById("textbox2").value;
// Do something with these values...
}
You'll need 'id' values in your elements but this should work. Also, 'document.getElementById' is old school, but you could also import the Dojo 'dom' and use 'byId' that way.