Hi,
I want to have an input text and give the user feedback bu showing a green or red circle on a sketchpad, depending if the answer was correct. Nut I saw my input text variable is not recgnised in the inline javascript, onlty in logger, so how can I give the user that feedback?
Comments
Hi @Raanan
I'm not sure why you can't access your variable.
Are you using the correct syntax to call your variable? JavaScript variables should be preceded by 'vars', for example: vars.your_var_name. Also, make sure that your inline script is placed after the response has been submitted.
If you could share any additional details or your experiment file, that might help us to understand what's going wrong.
Thanks,
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
It should definitely be possible to provide feedback based on user input, but the main issue is usually how and when the variable is accessed. Make sure the input variable is properly defined and that your inline JavaScript runs after the response has been submitted and stored. Once the value is accessible, you can easily compare it with the correct answer and trigger a green or red circle on the sketchpad for instant feedback.
This kind of real-time validation is widely used in educational tools as well. For example, in a [spelling bee game]( https://spellbee.us/), users type a word and immediately see whether it is correct or not. Instant visual feedback not only improves engagement but also strengthens learning outcomes by helping users correct mistakes right away.