JS Code: Stuck on Initializing Experiment

URL of experiment:


Description of the problem:

First off, I know that similar problems have been posted before, but I haven’t been able to find the error in the code (I did consult the crib sheet).

I’ve added a dialogue box at the beginning of my experiment to collect participant info. Currently I’m just experimenting with the code that I took from this programming guide.

It works fine in builder but on Pavlovia I’m stuck on initializing experiment, so I assume there is an error in the Python - JS conversion. Here’s the section of the code:

// Start code blocks for 'Before Experiment'
import { gui } from 'psychopy';
var ID, myDialogueBox;
myDialogueBox = new gui.Dlg({"title": "Dialogue Box Exercise"});
myDialogueBox = new gui.Dlg({"title": "My Box", "pos": [400, 350]});
myDialogueBox.addText("Please fill in the following fields:");
myDialogueBox.addField("Participant ID:");
myDialogueBox.addField("Participant ID:", {"color": "blue"});
myDialogueBox.addField("Gender:", {"choices": ["F", "M"]});
if (myDialogueBox.OK) {
    ID = myDialogueBox.data;

The rest of the code can be seen in the GitHub link above. The experiment was running fine before I added the dialogue box.

Could anyone help me get this running?
Thanks in advance.

Is there a reason why you aren’t using the dialogue box in Experiment Settings / Basic in Builder?

(The error message is Relative references must start with either “/”, “./”, or “…/”.)

Is it possible to use a dropdown menu in the default dialogue box? If so, I would happily use that.

Try adding lists like this as the default options: [“F”, “M”]

Sorry for the slow reply.

Yes, it is possible to use drop down menus in the default dialogue box in the Experiment Settings! I hope this information is useful to others, as I couldn’t find it anywhere else.