Hi there,
I want to implement a trial structure where first a picture is presented for 10 sec, then the next page is automatically shown on wich there are ratings. This is to be repeated 40x in total and the presentation order of the trials should be rotated per participant.
Here is what I have done:
1. On the very first page, I have a PHP code accessing the "Zufallsgenerator" to rotate the survey pages:
question('AA01'); // Zettel in zufälliger Reihenfolge ziehen
$pages = valueList('AA01', NULL, 'label'); // Gezogene Zettel auslesen
setPageOrder($pages); // Seiten als Seitenabfolge definieren
2a. Each "picture page" has a timer consisting of PHP code:
$time0 = time();
$timer = 10; // Der Teilnehmer hat 10 Sekunden Zeit zur Bearbeitung
if (time() >= $time0 + $timer) {
goToPage('next');
}
// Die verbleibende Zeit muss auch dem JavaScript-Code bekannt gemacht werden
$remain = $time0 + $timer - time();
replace('%remain%', $remain);
2b. followed by HTML code:
<script type="text/javascript">
<!--
// Funktion zur Weiterleitung
function weiter() {
// Den Teilnehmer zur nächsten Seite weiterleiten
SoSciTools.submitPage();
}
// Weiter-Knopf ausblenden (optional)
SoSciTools.submitButtonsHide();
// Initialisierung der Weiterleitung
SoSciTools.attachEvent(window, "load", function(evt) {
// Timer für automatische Weiterleitung starten
window.setTimeout(weiter, %remain% * 1000);
});
// -->
</script>
I have tested the rotation and the timer separately, there all worked fine. Using both together, however, the rotation does mysterious things, e.g., presenting trials more than once. I am assuming that both functions influence the page order in some way and one is overwriting the other. But I don't know how to fix it... Could you help?
Thank you!