Disable the Enter Key in Your Survey

We strongly recommend only using this feature in a controlled environment, because disabling the enter key will render the survey un-completable for screen reader and keyboard-only users. 

When you have survey pages with open text fields, it's possible for a survey respondent to submit the page by accidentally pressing the Enter key before completing their response. With this bit of code, you can ensure that won't happen!

Place this code in the theme of your survey.

  1. To do so go to the Style tab and scroll to the bottom of the survey preview to access the HTML/CSS Editor.
  2. Paste the following code below the existing HTML on the Custom HTML tab:

<script>
$(document).ready(function(){
  $("form :input:not(textarea)").on("keypress", function(e) {
    return e.keyCode != 13;
});
$("form :input:not(textarea)").on("keydown", function(e) {
    return e.keyCode != 13;
});
});
</script>

This code works best when applied to the whole survey but could also be applied to a single page using a JavaScript action. If you choose to use the JavaScript action on an individual page, make sure you don't have the desktop interaction set to one at a time.

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for Alchemer features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual SurveyGizmo Enterprise*
*Excludes Stakeholder
Feature Included In