# Feedback issue in online experiments

**URL:** <https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717>\
**Category:** Online experiments\
**Created:** [March 24, 2020, 8:19pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717 "2020-03-24T20:19:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarinaIosifian](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/marinaiosifian/32/7507_2.png) [@MarinaIosifian](https://discourse.psychopy.org/u/MarinaIosifian)\
**Post date:** [March 24, 2020, 8:19pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/1 "2020-03-24T20:19:01Z")

</div>

Hi,  
I am having a problem with the feedback in my experiment. It runs correctly in Builder.  
But online - there is no feedback. I read about this issue and it seemed to be easy to fix, but strangely it is not working. I have a coding components with the following:

**Begin experiment**

```
msg = "";

```

**Begin routine**

```auto
if not response.corr:
    msg = "No response"
    msgColor = "red"
elif response.corr == 1:
    msg = "Correct!"
    msgColor = "green"
else:
    msg = "Error!"
    msgColor = "red"

```

I read that I need to translate this code into JavaScript in order it to work on Pavlovia. I did it automatically using Auto JS function in Psychopy3. So now when I try to launch the experiment in Pavlovia, it works but there is no feedback. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 24, 2020, 9:46pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/2 "2020-03-24T21:46:00Z")

</div>

Can you share the experiment repository on Pavlovia? This is the Python code, but in order to figure out what’s not working online, the JavaScript is what’s relevant.

To be clear, is it not giving you any feedback at all, or is it giving you the wrong feedback? There can be issues with resposne.corr because Python and JavaScript use different key-codes, see [Pavlovia storing all key\_resp\_stimuli.corr as wrong](https://discourse.psychopy.org/t/pavlovia-storing-all-key-resp-stimuli-corr-as-wrong/11661)

---

<div class="post-metadata">

**Author:** ![MarinaIosifian](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/marinaiosifian/32/7507_2.png) [@MarinaIosifian](https://discourse.psychopy.org/u/MarinaIosifian)\
**Post date:** [March 24, 2020, 9:50pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/3 "2020-03-24T21:50:42Z")

</div>

Thanks Jonathan!  
For some strange reason now it is giving me the feedback. But not completely correct. Instead of “Error” - always “No Response”. Correct feedback is fine. And No Response also.

Here is the experiment’s URL:  
[https://run.pavlovia.org/MarinaIosifian/semantic-primining-children/html](https://run.pavlovia.org/MarinaIosifian/semantic-primining-children/html)

And this is how translated JavaScript looks like:

```auto
if ((! response.corr)) {
    msg = "No response";
    msgColor = "red";
} else {
    if ((response.corr === 1)) {
        msg = "Correct!";
        msgColor = "green";
    } else {
        msg = "Error!";
        msgColor = "red";
    }
}

```

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 24, 2020, 10:23pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/4 "2020-03-24T22:23:51Z")

</div>

Yep, that’s the same issue as the thread I linked. response.corr is always being coded “wrong”. You may need to specify what the “correct” keys are in a different way. Try replacing whatever “correct” is with the JavaScript key-codes for those keys, which you can get from here: [https://keycode.info/](https://keycode.info/)

---

<div class="post-metadata">

**Author:** ![MarinaIosifian](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/marinaiosifian/32/7507_2.png) [@MarinaIosifian](https://discourse.psychopy.org/u/MarinaIosifian)\
**Post date:** [March 25, 2020, 10:09am UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/5 "2020-03-25T10:09:05Z")

</div>

Thanks Jonathan! My correct answers are keys “e” and “i”. So in my conditions xlsx file instead of “e” and “i” I put JS codes (69 and 73). In Builder the allowed keys are still “e” and “i” (or should I also put 69 and 73 instead?). I synchronized with Pavlovia, but the response.corr is still being coded as “wrong”…

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [March 25, 2020, 12:11pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/6 "2020-03-25T12:11:01Z")

</div>

This is one where I’m actually not 100% on exactly what Pavlovia needs because I haven’t used this particular functionality myself. There are multiple ways that keycodes can be read off by JavaScript, so I’m going to recommend trying different permutations until one works. For example, try KeyE and KeyI.

The “allowed keys” should only affect whether it accepts those keys as input at all, so if it’s recognizing the key-presses than that should be fine. You could also look in your code repository in the html folder and see how the JS renders the “allowed keys” for the keyboard object (just search for the name of the keyboard component in the JS file), and see how they’re listed there.

---

<div class="post-metadata">

**Author:** ![MarinaIosifian](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/marinaiosifian/32/7507_2.png) [@MarinaIosifian](https://discourse.psychopy.org/u/MarinaIosifian)\
**Post date:** [March 25, 2020, 12:27pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/7 "2020-03-25T12:27:23Z")

</div>

Strangely enough I only get my “Correct” feedback when I code the keys as e and i. KeyE does not seem to work, neither 69.  
Thanks a lot, Jonathan! At least it seems to be working now!

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [March 29, 2020, 2:17pm UTC](https://discourse.psychopy.org/t/feedback-issue-in-online-experiments/11717/8 "2020-03-29T14:17:15Z")

</div>

I think this isn’t to do with keycodes. PsychoJS should be translating your keycodes to the same equivalent values as PsychoPy.

> [@MarinaIosifian](#):
>
> Instead of “Error” - always “No Response”.

I think the issue is your code logic (I think in the python version it should also be giving “no response” instead of any “error”). If no response then `response.corr == None` and if incorrect response then `response.corr==0` but _both_ of those fall under the heading `not response`.

I think you want this:

```auto
if len(response.keys)==0:
    msg = "No response"
    msgColor = "red"
elif response.corr == 1:
    msg = "Correct!"
    msgColor = "green"
else:
    msg = "Error!"
    msgColor = "red"

```

and I believe that should correctly autotranslate into JS andd work there too.

But move your key definitions back to the letter names as in the python version. That should be the same
