Hi,

When clicked twice (double click) "Next" -button (after selecting answer option) it throws "Access denied" -page.

Quiz settings are:
Categorized random questions (multiple choice)

This issue appears at least in 2 different sites which have the latest versions of Dupal (7.31) and Quiz 7.x-5.0-alpha4.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greenwork’s picture

I am seeing the same issue as well on 7.5 dev

It appears to only happen on my end when I have strict rules on no backward navigation as well as no resume. I assume it has to do with the resume option.

greenwork’s picture

I noticed it still happened. One thing I am doing now is when my question is updated I go to the quiz and edit the quiz. An update question option exists on the question table. So far so good.

Maybe this has something to do with it.

jukka792’s picture

At least this "access denied" -page appears when none of these are checked in the "taking options" of the quiz settings:

  • Allow Resume
  • Allow Skipping questions
  • Allow jumping
  • Backwards navigation
  • Repeat until correct
  • Mark Doubtful
  • Show passed status

Haven't tested with other combinations.

Solution could be to hide the "next" -button using javascript so that two clicks are not possible.

jukka792’s picture

Tested more..

When "allow jumping" and "allow skipping" is on, everything is working fine.
When those are off, clicking twice "next" -button throws you to "access denied" -page.
(Manually change the URL address to next node number and quiz will continue normally).

djdevin’s picture

I reproduced this, can't figure it out yet.

My guess is that the current question counter is being incremented, however the same question is being submitted 2x.

So when it goes to redirect, it redirects to the wrong question.

greenwork’s picture

allow skipping did not change the double click problem. I think you are right on the submitted 2x part for the same question.

Here is a decent article
http://biostall.com/disabling-submit-button-to-prevent-double-form-submi...

greenwork’s picture

backward navigation and resume fixed this problem for me so far. I think with backward nav you are allowed to change your answers. Double clicking is probably submitting it 2x for the same answer.

greenwork’s picture

Resume is a bit of a problem though because it causes all anon users to resume the same exam.

greenwork’s picture

Can anyone confirm that all anon users resume the same exam or get access denied depending upon if resume and backward nav are selected.

Maybe its just my setup currently. Our workaround will be to have everyone Log in.

djdevin’s picture

@greenwe, you might be right, typically I do not give permission for anon to take quiz so I may not have noticed it. Give me a day or two to correct it.

djdevin’s picture

@greenwe The fix was easy, I made an issue here: #2367361: anonymous user should not be allowed to resume quiz

djdevin’s picture

Version: 7.x-5.0-alpha4 » 7.x-5.x-dev
Status: Active » Needs review
FileSize
1.24 KB

Can someone try this patch?

I was able to reproduce before the patch, and could not reproduce after this patch.

Basically it detects if the current question is not where they are, it assumes that a double click happened, and redirects.

The trick is clicking, then clicking a little bit after the last click before the browser redirects. All about the timing!

greenwork’s picture

Tested both and they appear to fix the issues. The anon issue was resolved in your other patch. Double clicking without resume or skipping is not creating an error and properly progresses to the next slide. Will revert over the next 24 hours after more testing.

djdevin’s picture

Great this is probably the fix then. Note the page does not work with pages yet but the concept is the same.

jukka792’s picture

#12 Works here also! Thanks a lot.

djdevin’s picture

Youlearnit’s picture

Tried to apply this patch to RC1 but got these errors:
Notice: Undefined property: QuizResult::$layout in quiz_access_question() (line 3632 of quiz.module).

gun_dose’s picture

Version: 7.x-5.x-dev » 7.x-5.0-rc1

As mentioned above, in 7.x-5.0-rc1 this patch doesn't work and causes error, that totally breaks quiz - answers are not accepted and clicking any button causes only refreshing of current page with error message. I couldn't fix this patch so I solved this problem without patch in another way - by javascript, that adds class "clicked" to all buttons after the first click and prevents default on buttons, that has this class

Status: Needs review » Needs work

The last submitted patch, 17: double_click_of_next-2343113-17.patch, failed testing.

djdevin’s picture

Version: 7.x-5.0-rc1 » 7.x-5.x-dev
Status: Needs work » Needs review
FileSize
817 bytes

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 21: double_click_of_next-2343113-21.patch, failed testing.

joelpittet’s picture

Can this kludge include a check for the upper bound/total # of questions to avoid going past? I'm getting a bunch of

Notice: Undefined offset: 11 in quiz_access_question() (line 3568 of quiz/quiz.module).

And I think it's due to this.

jukka792’s picture

I was able to solve this problem by hiding the "next" -button using javascript after click.

vmkazakoff’s picture

jQuery(document).ready(function(){

jQuery('#quiz-question-answering-form').one('submit', function() {
     jQuery(this).find('button').attr('disabled','disabled');
 });

});