Disable the Enter Key in Your Survey

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!

Legacy Custom Scripting Language Deprecation Plans 

  1. New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
  2. As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
  3. In the long term, Legacy Custom Scripting Actions will be switched to read-only. The exact date on this is to be determined; we will send notifications well ahead of time.

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 SurveyGizmo features and functionality ideas that might meet your customization. Beyond this, you might want to consult with someone on our Programming Services Team; these folks might have the scripting chops to help you to achieve what you are looking for!