Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Quick question about double alert messages

Quick question about double alert messages 2 years 8 months ago #64646

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
Hi Team,

I don't think that this is the right place to ask this question so feel free to delete the question.

Can you point me in the right direction as to why the alert in the following question is repeating twice? The code initiates when a previous/next button is clicked, and the alert is correctly only shown when the 'Next' button is clicked. However, the alert repeats twice. Any ideas or pointing me into the right direction would be brilliant.
$(document).ready(function() {
	$('form#limesurvey').submit(function(){	
 
 
		if (document.limesurvey.move.value == 'moveprev') {
		}
 
		else {
			$('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', '');
			alert("FORWARD");
 
		};
 
	});
 
});
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64669

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
What version are you using? There was a bug causing the submit function to fire twice but I believe it was fixed - bugs.limesurvey.org/view.php?id=4985
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64672

  • paulfiner
  • paulfiner's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 92
  • Thank you received: 1
  • Karma: 1
I too am seeing double alert messages. I'm using the latest build.

Cheers

Paul
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64673

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
I couldn't find the build number but the bottom of the screen reads as v1.91+ which I think is later than Bugfix in the report.

Any ideas how to get around the problem?
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64674

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
Can one of you please activate a sample survey?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64676

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
Hi both :)

The bug isn't replicated using the sample survey in the bug report that you linked. Also, by constant breakpoints and commenting out, I've managed to locate what seems to be causing the problem but I have no idea why it would be causing such an issue.

In the same script, I am using the 'Multiple questions types' workaround from here: docs.limesurvey.org/tiki-index.php?page=...stion_types_in_array

The double messages only appear when the line is run:
    $('.'+this+'').wrapAll('<div id="inlineWrapper'+i+'" class="inlineRow" />');

The line in context is:
//Wrap each "row" in a wrapper div
$(rowList).each(function(i) {
    $('.'+this+'').wrapAll('<div id="inlineWrapper'+i+'" class="inlineRow" />');
}); 

I have commented out the line, and the script runs perfectly (though the layout from the workaround does not work).

I have also commented out later reference to inlineWrapper and inlineRow but these have no impact at all. Consequently, I think it is something to do with wrapAll (I've also checked and 'this' doesn't ever seem to call the submit button)

Any ideas?

J.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64679

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
Not really. In that line, 'this' simply references an array item that is being inserted as a class for the selector. All elements that match the selector are then wrapped in a new <div> element. So the loop is actually:
$('qRow0 ').wrapAll('<div id="inlineWrapper0" class="inlineRow" />');
$('qRow1 ').wrapAll('<div id="inlineWrapper1" class="inlineRow" />');
$('qRow2 ').wrapAll('<div id="inlineWrapper2" class="inlineRow" />');
$('qRow3 ').wrapAll('<div id="inlineWrapper3" class="inlineRow" />');
...

And I still haven't been able to reproduce it. Is it browser-specific?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64680

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
Yep, I put breakpoints in to see the value of 'this' before, and it produced something similar to the output you provided.

I have reproduced the error in Chrome, IE, Safari and Firefox (all latest versions).

I can't work out why commenting out that line solves the problem.

The error still occurs even when I choose different names for 'inlineWrapper/Row' (just in case it was an issue of the script halting because other lines relied on that line being present).

Hmm.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64682

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
Can you activate a small sample survey?
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Quick question about double alert messages 2 years 8 months ago #64695

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
Hi Tony,

Sure, if you don't mind having a look.

phd-research.limequery.com/38368/lang-en

Thanks, J.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.271 seconds
Donation Image