Form designer: How to disable the Enter key on web form


#1

Form submission by pressing the ENTER key is standard HTML form behavior.

To disable this, click the gear icon in the Form Designer toolbar to open the Form configuration panel; then, on the Web References tab, add the following JavaScript code:

<script type="text/javascript">

function stopRKey(evt) { 
    var evt = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) {
        return false;
    }
}

document.onkeypress = stopRKey;

</script>

Reference: http://webcheatsheet.com/javascript/disable_enter_key.php