I am trying to the "startComponent" function using the ID of each task in my JATOS project. It does not work though. I do not even get any errors. Where in my code do I add the jatos.startComponent(##) so that it works?
A full example would be really appreciated.
Thank you
Comments
Hi,
Maybe you don't put it inside the jatos.onLoad? Anyway here is simple example
<!DOCTYPE html> <html> <head> <script src="jatos.js"></script> </head> <body> <p>Press any key to continue</p> <script> jatos.onLoad(function () { // Wait for any key press and start next component document.onkeypress = function (e) { // Using the component's UUID jatos.startComponent("2502c4b4-9aba-4703-8d4f-fa034300ca5c"); // Using the component's ID //jatos.startComponent(3); // Just jump to the next component //jatos.startNextComponent(); }; }); </script> </body> </html>Best,
Kristian
Hello Kri,
Thank you for the response. I have tried that and it also does not work. The code as you have it provided me with an error saying the component does not exist. Which is good. When I add my own UUID I do not even get an error, I am brought straight back to the JATOS interface. Any ideas? I am working with JATOS local.
Just to be clear, when you use
jatos.startComponent("my-uuid")you use the UUID of the component you want to jump to, as specified in the Component Properties, right? And another questions: Which JATOS version do you use?Hello Kri,
Sorry that I wasted your time. It works.
I was pressing the run button of the component and not the run button for the study
Thank you,