Description of the problem: I have created an experiment in the Builder and added JS code to customise response options so I can run it online. The experiment works just fine in Chrome. However, when I run it on Firefox, I get a specific kind of error. I have several trials in which participants have to enter a letter into a text box to choose a response option. Allowed letters are a to f. When participants enter any of these letters, an image appears in the right lower corner saying “Click here to continue”. If they click this image they advance the trial. If a character is entered that is not allowed, an error message appears saying “Error: only a, b, c, d, e and f are permitted.” When I run this in Firefox, the trial works as intended but only if my first entry is an allowed character and I don’t empty the text box and write something else after that. If I type in any character, delete it and type in another character, the continue graphic never appears and the trial cannot advance, even if a correct character between a and f was entered.
This is what it looks like on Firefox:
-
If a correct response was the first one made:
-
If the first response is deleted and the box is empty, the error message appears:
-
If another character is now entered (even if it is a correct one), the error message remains and the continue graphic never shows up. The trial therefore never advances:
The code is the following in the “Each Frame” window:
// Preallocate
var current_response;
var allowed_characters;
allowed_characters = /[1]+$/;
current_response = memq_box.text;
if ((current_response.length > 0)) {
if (!allowed_characters.test(current_response)) {
memq_error_message.color = “red”;
memq_cont.opacity = 0;
} else {
memq_error_message.color = “lightgrey”;
memq_cont.opacity = 1;
if (memq_click.isPressedIn(memq_cont)) {
continueRoutine = false;
}
}
} else {
memq_error_message.color = “lightgrey”;
memq_cont.opacity = 0;
}
If anyone knows how to fix this I would really appreciate any help!
abcdef, ↩︎