psychopy.org | Reference | Downloads | Github

Unspecified JavaScript error

URL of experiment:https://run.pavlovia.org/Cami94/iatbrandbias/html/

Description of the problem: Hi! Everything works perfectly in builder, I get the data as I want in CSV.
But when uploaded to pavlovia I get Unspecified JavaScript error, where should i start looking for the problem?

Have NO EXPERIENCE in ANY kind of coding, or what so ever,
I am a marketing student who wanted to get an IAT-test for my thesis…

I tracked down the repository, and something weird is going on here. You actually have multiple copies of the experiment code. One of them is in the HTML folder, where it should be, while the other is just in the main folder, where it should not be.

When did you add a gender field to your participant information? That will help me figure out which one is the more recent version.

Hi!,
ok, tried “cleaning up”. only keeping the current files… no improvement.
Sorry I have no idea of when… is it possible to generate a new code??

Also, HOW is it possible that it works flawless in builder but not online?!

Thank you so much for taking the time to reply, can’t tell you how much i appreciate it!!

This part I can explain. When you run it on your own computer, it’s running Python code, compiled on what you built in the builder. When you run it online, you are running JavaScript, which is also compiled based on what you put in the builder, but it’s actually something completely different. It is one of the most impressive accomplishments of PsychoPy that it can convert builder experiments into either Python or JavaScript and have them behave more or less the same way most of the time, because they are very different things. Just, sometimes things go haywire.

I’ll have a look at this in a bit, but this error is genuinely strange, so for what it’s worth, you’re not the only one puzzled!

1 Like

…Well, there is always a silver lining!

thank you for the explanation, is there anyway that I manually can export a new JavaScript file?

once more, you are awesome, THANK YOU!

Good news, I have a fix. Less good news, I have only a vague guess as to why it works.

Basically there’s something about your participant info, particularly the Gender field, that it breaking it. I don’t know exactly why, but it looks like either the options provided or the tag of the field itself broke some kind of parsing. I made a copy of the experiment, removed the field, re-synched my copy, made it inactive, and then set it to piloting again, and now it just works.

So try that, and hopefully it works.

you are a wonderful human beeing!
worked, but only partially, the test is staring,

but now it seems like i have a problem with the actual test part,

now I get win is not defined…

also now that i tried running it localy it still works, but I get none as a code

There are a few things going on here.

W/r/t the “win is not defined” error, in builder, go to the “form” trial, open the code component and in the right panel of the “each frame” tab it you will see this:

slider_8 = new visual.Slider({"win": win, "name": "slider_8", "size": [0.9, 0.05], "pos": [0, (- 0.2)], "labels": options, "ticks": [1, 2, 3, 4], "granularity": 1, "style": ["radio"], "color": "LightGray", "font": "HelveticaBold", "labelHeight": 0.025, "labelWrapWidth": 0.2, "flip": false});
console.log(options);

Replace it with this:

slider_8 = new visual.Slider({win: psychoJS.window, name: 'slider_8', size: [0.9, 0.05], pos: [0, (- 0.2)], labels: options, ticks: [1, 2, 3, 4], granularity: 1, style: ['radio'], color: 'LightGray', font: 'HelveticaBold', labelHeight: 0.025, labelWrapWidth: 0.2, flip: false});
console.log(options);

That should solve that problem I think. If that gives you trouble, try putting the quotes back around the labels before each colon, but I think this should work.

With regard to getting “none” as code, it’s printing whatever the “options” for that same slider are. The “options” variable is set in form_1.xlsx, and it looks like that column is blank, so that’s behaving as expected from a programming standpoint. Whatever you put in that column is what will appear in that output.

1 Like

Thank youuuu!!! !!!
Now I only have 2 more issues…

  1. that JS code, does not define the ticks, as now they are not visible, what should i add to that code?

  2. I get these letters NaN on my image stimulis now, how do I remove it?

I really can’t thank you enough you ar literary saving my thesis!

  1. Is it related to this? No marker for slider online

  2. That seems to be something with the OpenIAT task in particular. You aren’t the only one seeing that: Problem with presenting stimuli in OpenIAT. I think it’s the “Text_stim” component on the trial. If you aren’t using it, remove it? Or add a column for it in whatever is controlling the trial loop and make each entry ' ', which should render as blank.

1 Like

Forever in your debt, THANK YOU <3

Hi again… the text for the tics in the form trial did not present itself in some screens so i went in and adjusted it, and now it is not working again,
tried manually exporting the html files but nothing works… is there anyway to change it back to yesterdays version?

Not working again how?

Also try clearing your browser cache. It turns out Pavlovia was not built with the intent of running the same study on the same computer many times in a row, so sometimes information stored in the browser from previous runs can screw things up.

As for whether it is possible to revert, yes in principle but it’s not as easy as you’d think. There are git commands that would allow you to do this, but to be perfectly honest I’m not sure how to get that working with Pavlovia’s GitLab repository. The ugly brute force solution is to go to your gitlab repository, go to “history,” find the last working revision, click on the folder icon next to it, download that version of the repository, and then either replace the folder on your local computer with the downloaded repository or make a new experiment from it.