ReferenceError - variable not defined issues

Code: Sign in · GitLab

Description of the problem:error

Hey there! I have an experiment that runs perfectly offline, but I get this reference error whenever I run the experiment online. The experiment is set up to allow for free text to be input by the participant, and inputText is defined within the code custom component in builder view. I am not sure which steps to take to resolve this issue, and any advice would be appreciated, thanks!

Right now you have to translate the Python code into JavaScript by hand and paste it into the right hand panel of the Code Component after selecting the “both” option at the top of the dialog.

We do have auto-translation in the works, but it itsn’t quite there yet.

1 Like

Hi, I’d like to verify the current status of this issue? Should certain Python code still be translated to Java, and will this work if we directly edit the html/_.j on a Pavlovia experiment that has already been posted?

Hi @cmamir, you only have to translate custom code in the code components, everything else is automated by PsychoPy. When you open the code component, you have the menu of code type, where you can choose Py (Python), JS (JavaScript), or Both. If you select both, Python is presented in the left panel, and JS is presented in the right panel. This helps with translation. Note, this is JavaScript and not Java, which is a different language. You can edit the javascript that is output, but we suggest that you make your translations from Builder in the code components.

1 Like