Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Assign specific keyboard shortcut to submit question

Hi Guys,

I have a long data entry project, so, i need the Enter button to automatically submit the page in the survey link instead of moving with the mouse to the next button..

is that possible? Thank you
asked Dec 20, 2020 by Ahmed Anwer Bronze (700 points)
edited Dec 21, 2020 by Ahmed Anwer
I believe this is already the behavior of some question types (e.g., single-line open-end questions).  Is there a specific question type you want to add this behavior to?
You're right, I tried it on a single-line open ended question and it worked, but I want this to be a natural behavior in numeric, single, and multiple choices questions also (the whole page to be more specific) (in other words, I need to the Enter button to work exactly as the Next/Submit button)

2 Answers

+1 vote
 
Best answer
Try adding this to your survey's HTML head:

<script>
$(document).keypress(function(e){
    if (e.which == 13) {
        SSI_SubmitMe();
    }
})
</script>


Or this version that won't trip on multiline text elements:

<script>
$(document).keypress(function(e){
    if (e.which == 13 && !$(e.target).is('textarea')) {
        SSI_SubmitMe();
    }
})
</script>
answered Jan 18 by Zachary Platinum Sawtooth Software, Inc. (161,250 points)
selected Jan 19 by Ahmed Anwer
This is exactly what I had in my mind, Thank you Zachary!
0 votes
Maybe this piece of code helps you. I found it in the Sawtooth Library -> Tricks-> AutoSubmit:

<script>
//The code below will submit the page when a radio button is selected.
function SSI_CustomGraphicalRadiobox(GraphicalRadioObj, InputObj)
{
       SSI_SubmitMe();
}
</script>
answered Jan 13 by Alex C. (350 points)
...