TypeError: state.toLowerCase is not a function

also in case it matters, the editable textbox is in a separate routine after the trial that is looped over, contains the JScode, and requires the list appending.

Have you tried removing append = push and then manually changing append to push in the JS sides of the relevant code components (changing auto to both)

Ah, well after doing that the error is gone/no crashing! But while my Textbox now appears, it is not actually editable…

Ah, no, actually it is working (was a separate issue with the textbox), thanks!

So to sum up.

Array.prototype.append = [].push; in code_JS is incompatible with an editable text box in PsychoPy 2020.2. Version 2021 is untested as is whether having an editable text box prior to the first use of append means that you don’t have to manually replace append with push in code components.

Does that match your experience?

Yup, that sums it up.

Thanks. I’ve added a note to my crib sheet

2 Likes

I am using this textbox to collect pp info and for debrief after the experiment.

The textbox works when i put the append = push line AFTER collecting the pp info, but then I have the issue again at the debrief.

Probably a dumb question, but how can I ‘undo’ the ‘append = push’ line for the debrief? I tried Array.prototype.append = Array.prototype.append; but that did not work.

If you have a conflict then you could try Thomas Pronk / demo_polyfill · GitLab instead of using my crib sheet for code_JS.

Alternatively, you should avoid defining Array.prototype.append and instead change append to push manually at each occurance by switching the components to Both.

1 Like