| Reference | Downloads | Github

Restricting the use of enter

Could anyone possible help me to write a code? I want my participants not to allow press ‘enter’ without giving an answer. My design is attached.

When I allow them to use enter in any case, I notice that sometimes they skip the question because of pressing enter too strongly (or a few times) for previous question. so, I do not want to allow them to use ‘enter’ without giving an answer.

ThanksPart 1.xlsx (14.8 KB)|attachment Latest Experiment_HC.psyexp (47.7 KB) Part 0.xlsx (11.4 KB)

Hi @em_zey_maths, take a look at our text input demo. If you only want the participant to be able to end a trial after a response has been made, you should check the length of the text in your text component before allowing a return response to end a trial:

if 'return' in keys:
   if len(text.text):
       continueRoutine = False;

Here is the working example:
inputText.psyexp (16.5 KB)
cond.xlsx (7.8 KB)