Forum Discussion

Sabinede-Kamps1's avatar
Sabinede-Kamps1
Community Member
12 years ago

Prevent enter key from submitting text entry for evaluation

Hi,

I am having a problem with the text entry. I would like the learner to be able to type a longer text into the text entry box. When he presses 'enter', a line break should be created within the text entry box. However, as soon as the learner presses the enter key, the text is automatically submitted and the learner is moved on to the next slide. Is there a way around this? I deleted the 'next' and 'submit' button and created my own submit button, but this didn't work either. Can anybody help? Thank you.

Sabine

47 Replies

  • Hello Christina!

    It sounds like you're looking for the option to choose whether the Enter key will allow a user to submit a question or add a line break. I'm happy to share this approach with my team.

    Currently, when there's a data-entry field on a question slide, pressing the Enter key on the keyboard submits your response for evaluation. Using Shift+Enter will add line breaks. On a content slide, Enter or Shift+Enter adds a line break (return), so you can start a new paragraph.

    I did find a workaround that to be honest, is a bit clunky but it does the trick. Here's a quick demo!

  • To whomever still needs this functionality, I did find a workaround. Essay didn't work for me because we needed people to be able to see and print, if desired, what they entered and what the suggested responses are with the Review Result option. We hope people don't use the enter key, but we can't control what users decide to do.

    I will say, it is a little annoying that we have options for how to submit in the quiz form - which is to use a button and (or at least it seem so) to submit with a keystroke. One would assume if that is blank, that a keystroke would be ignored. 

    That said, here's how I got this to work (you may need to modify it a bit based on your needs):

    Note: I used a custom Submit button in the page, but this should work with the player submit button.
    I did have some extra stuff to suppress the Next button and show the custom submit button until the slide was answered (so on review they can use the Next button) - so this shouldn't change anything - I just mention it in case...

    Question type: Fill in the blank (I had a longer entry box)
    Question properties: Feedback "By Question", Attempts Unlimited

    Setup:
    Create variable FIXEnterPressed (True/False)
    Add a trigger - change FIXEnterPressed to FALSE when the timeline starts

    On the Submit button (on click), add the triggers to adjust FIXEnterPressed to TRUE and then Submit interaction (order is important)

    Delete the Correct and Incorrect feedback layers. Make the Try again layer blank (change the master and delete any 'artifacts' that may remain), set the timeline to the shortest time (we really only want it open for a very short time, just to run a trigger)

    Adjust Try Again layer properties to: Hide other slide layers (or not, really shouldn't matter), Hide slide layer when timeline finishes, revisiting: Initial State, (others are deselected)

    Add a trigger in Try again layer to jump to next slide when timeline starts if (condition) FIXEnterPressed is equal to True

    ---

    So essentially what we're doing here is passing a variable to check when Submit is pressed vs when someone presses Enter. We have to hack it by using the Try Again layer, otherwise the question submits before anything else, so we can't really hijack the logic.

    Ideally and hopefully the question properties will be updated so they comply with our wishes (i.e. if we want either ENTER key OR some sort of Submit button OR ENTER key AND submit button to submit the interaction) - but until then, hopefully this will help someone.

    Best--L