Moodle for mobile

how to force user answer to all question?

how to force user answer to all question?


i do something in moodle server to force user to answer all question of quiz (write some code in mod/quiz/processattempt.php) and it is work in the moodle web side.

now i want do similar in the moodle mobile and force user to check all question in each quiz page and if he don't check that, the nextpage button not redirect to nextpage or redirect to CurrentPage. I read some function about nextpage in

but i don't understand what file is better to edit or is needed server file edited or need edit moodle mobile file's edit too?

Average of ratings: -
Re: how to force user answer to all question?

i do this and it work for me only for moodle web not moodle mobile.

modify mod/quiz/processattempt.php line 84 by add this:

//1360 is your quiz id

// Check all questions in this page MUST be completed

$quizIDs_MustCompleteAnswered = Array ("1360");

if (in_array($attemptobj->get_cmid(), $quizIDs_MustCompleteAnswered)) {

// V2

$questionids = $attemptobj->get_slots($thispage);

$questions = array();

$questions_state = array();

foreach ($questionids as $key => $id) {

$questions[$key] = $attemptobj->get_question_attempt($id);

$questions_state[$key] = $attemptobj->get_question_state($id);

if ($questions_state[$key] != question_state::$complete) {

$next = false;



also add custom js for "Next page" button to your moodle is good but both php and js is best way.

Average of ratings: -
Picture of Dani Palou
Re: how to force user answer to all question?
Core developersMoodle HQParticularly helpful MoodlersPlugin developers


the mobile app calls the WebService mod_quiz_process_attempt with the answers when changing page. You should modify that WebService to check if all the answers have been supplied, and return an error if they aren't.



Average of ratings: -