Delay on submit button

6 views
Skip to first unread message

Heidi Vuletich

unread,
May 7, 2024, 1:39:58 PMMay 7
to Minno.js
Hi!

I want to implement a page where the "submit" button appears after a certain delay. I followed the conversation here, and was able to write the following code in a js file, which works when I preview the js file. However, when I run my experiment through the expt file, the code no longer works and I get the submit button right away. Any help is appreciated!!
 

//Timed instruction question

API.addQuestionsSet('infoQuest',{
inherit :'basicSelect',
name: 'infoQuest',
stem:     '<p class="lead"><br/><br/>The instruction text goes here.' +
                    '<br/><br/>When the “Continue” button appears, you may begin.'+
                    '<br/><br/>',
                onLoad: function(log, current) { // hide continue button
                document.querySelector('#task > div > div.ng-scope.ng-isolate-scope > div > div > div.page-buttons').style.visibility = "hidden";
                var delayInMilliseconds = 20000;
                setTimeout(function() {
                      //this code will be executed after 20 seconds
                      //console.log("done");
                                  //document.querySelector('#task > div > div.ng-scope.ng-isolate-scope > div > div > div.page-buttons').style.opacity = 100;
                document.querySelector('#task > div > div.ng-scope.ng-isolate-scope > div > div > div.page-buttons').style.visibility = "visible";
                }, delayInMilliseconds);
            } // function ends
});


/**
/**
*Sequence of presentation
*/

API.addSequence([
//First, we present the neighborhood questions in a random order.
{
mixer : 'wrapper',
data : [
{
inherit:'basicPage',
questions: {inherit:{set:'infoQuest'}}
}
]
}
]);
return API.script;
});

Yoav Bar-Anan

unread,
May 7, 2024, 3:47:27 PMMay 7
to Heidi Vuletich, Minno.js

Hi Heidi,

Try changing the quesrtSelector argument in the code in the infoQuest question to:

            document.querySelector('.page-buttons').style.visibility = 'hidden';

And later:

            document.querySelector('.page-buttons').style.visibility = 'visible';


It did not work for me when running the questionnaire within the Dashboard with the play button, but it worked for me when I launched the study from the expt file.

I hope that helps,

Yoav


--
You received this message because you are subscribed to the Google Groups "Minno.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minnojs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minnojs/feb08430-7878-4e57-bfda-87de4a1ca7c9n%40googlegroups.com.

Heidi Vuletich

unread,
May 10, 2024, 4:45:50 PMMay 10
to Yoav Bar-Anan, Minno.js
Thank you so much!! This worked. 

Best,
Heidi

Reply all
Reply to author
Forward
0 new messages