Submit an editable grid with enter

While beating my head against a wall trying to figure out how to get records to save in an editable grid I finally found a hidden input variable with the input name “sc_contr_vert” Here is the javascript code you can use to submit records with enter or any other key you want.

function submitenter(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else keycode = e.which; 

if (keycode == 13) {
var n = F1.elements["sc_contr_vert"].value;
n = (n - 1);
findPos(this);
nm_atualiza_line('incluir', n);
return false;
} else return true;
}


document.F1.onkeypress=submitenter;