We have an online study in which participants have to do two separate parts. We want them to be randomly assigned to 1 of 6 conditions in the first part in the evening. The next morning, they have to do the second part of the study. We want them to be assigned to the same condition as in the first part, based on their participant number ('sona-id'). It works when we run it offline, but it doesn't work online with the java script. Does anyone know why? Thanks for your help!
Jill & fellow students
function GetSubjectNumber()
{
// This method prompts the subject for an id number and then prompts
again to // confirm in order avoid mistyped numbers.
var intRegExp = /(^\d{5,5}$)/;
var promptMsg = "Vul hier je sona-id in";
var confirmMsg = "Herhaal ajb je sona-id.";
var invalidMsg = "Het id was incorrect. Vul ajb het juiste id in";
var matchMsg = "De id'skwamen niet overeen. Vul ajb opnieuw je id in";
var snum = window.prompt(promptMsg, "");
while ( snum != null && intRegExp.test(snum) == false )
{
// if the input was invalid, prompt again
window.alert(invalidMsg);
snum = window.prompt(promptMsg, "");
}
if ( snum == null )
{
return null;
}
var sconfirm = window.prompt(confirmMsg, "");
while ( sconfirm != null && (sconfirm != snum || intRegExp.test(sconfirm) == false) )
{
// if the input was invalid, prompt again
if ( intRegExp.test(sconfirm) == false)
{
window.alert(invalidMsg);
}
// if the numbers do not match, alert the user and bail out so
they can start over
else if ( sconfirm != snum )
{
window.alert(matchMsg);
return null;
}
sconfirm = window.prompt(confirmMsg, "");
}
return sconfirm;
}
------------------------------
STUDY PART ONE
------------------------------
Conscious self
<expt>
/subjects = (1 of 6)
/blocks = [1= start ; 2= consciousself]
</expt>
Conscious other
<expt>
/subjects = (2 of 6)
/blocks = [1= start ; 2= truus ; 3= consciousother]
</expt>
Unconscious self
<expt>
/subjects = (3 of 6)
/blocks = [1= start ; 2=nback ; 3= unconsciousself]
</expt>
Unconscious other
<expt>
/subjects = (4 of 6)
/blocks = [1= start ; 2 = truus ; 3=nback ; 4= unconsciousother]
</expt>
Sleep self
<expt>
/subjects = (5 of 6)
/blocks = [1= startsleepself]
</expt>
Sleep other
<expt>
/subjects = (6 of 6)
/blocks = [1= start ; 2= truussleepother]
</expt>
-----------------------------------------
STUDY PART TWO
-----------------------------------------
Conscious self
<expt>
/subjects = (1 of 6)
/blocks = [1= keuze; 2=us2; 3=open]
</expt>
Conscious other
<expt>
/subjects = (2 of 6)
/blocks = [1=keuze2 ; 2=truus; 3=us2; 4=open]
</expt>
Unconscious self
<expt>
/subjects = (3 of 6)
/blocks = [1=keuze; 2=us2; 3=open]
</expt>
Unconscious other
<expt>
/subjects = (4 of 6)
/blocks = [1= keuze2 ; 2 = truus; 3=us2; 4=open]
</expt>
Sleep self
<expt>
/subjects = (5 of 6)
/blocks = [1= keuze3; 2=us2; 3=open]
</expt>
Sleep other
<expt>
/subjects = (6 of 6)
/blocks = [1= keuze4; 2= truus; 3=us2; 4=open ]
</expt>