returning inline string in OSweb (vs. OpenSesame)
I've got a congruency task I'm using to test expectancy violation and, while I'm sure someone would probably look at it and point out how inelegant the program is (I'm getting a messy logger warning), it's my first RT program and I have no real python experience (nor have time with a year to tenure to learn it--the OpenSesame tutorials were about as much time as I've got to learn). I tried looking for a task template to use, but couldn't find one (certainly would welcome one).
Anyways, I've got the osexp file, I'm working on getting an IRB-compliant server from IT services to run JATOS, and I want to be able to run the study on the web, using SONA Systems as a recruitment tool and wrapping it with Qualtrics.
As of now, I'm linking from Qualtrics (has consent) to the OSWeb experiment. At the end of the osexp, I've got an inline script that returns a random validation code in the sketchpad so I can append the OS data with the Qualtrics data. The code returns fine when I run the study in OpenSesame.
However when I test it in a browser, I get the following:
This is the code I've got in the inline script:
import random import string def randomStringDigits(stringLength=6): """Generate a random string of letters and digits """ lettersAndDigits = string.ascii_letters + string.digits return ''.join(random.choice(lettersAndDigits) for i in range(stringLength)) # store code exp.set("code", randomStringDigits(8))
And in the sketchpad:
set duration keypress set description "Displays stimuli" draw textline center=1 color=white font_bold=no font_family=sans font_italic=no font_size=30 html=yes show_if=always text="Thank you for taking the time to participate in our study!<br><br>We appreciate your effort!<br><br>Please take note of the following validation code:" x=0 y=-128 z_index=0 draw textline center=1 color=white font_bold=no font_family=sans font_italic=no font_size=50 html=yes show_if=always text="[code]" x=0 y=75 z_index=0 draw textline center=1 color=white font_bold=no font_family=sans font_italic=no font_size=30 html=yes show_if=always text="and press any key to continue.<br />(You will not be able to go backwards.)" x=0 y=224 z_index=0
How do I correct this so the code is returned in the OSWeb experiment so I can concatenate the two data sets? (Also, will OS log the code output so I have that info? How do I ensure that gets done?)
Alternately, does anyone have a more elegant way to pass an embedded data field in qualtrics (eg, a participant ID in SONA gets pulled into Qualtrics, passed through to OSWeb when they click on the link, and validated when they return to Qualtrics to complete the instrument and be awarded credit in SONA?