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

TOPIC: Quick question about double alert messages

Re: Quick question about double alert messages 3 years 1 month ago #64698

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
Okay, I don't get what is firing the submit function twice. Can you attach the survey here (or send me a PM if it's sensitive) so I can test it directly?

Paul, are you only seeing the problem when using the 'Multiple questions types' workaround?
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.
The following user(s) said Thank You: doodsonj

Re: Quick question about double alert messages 3 years 1 month ago #64700

  • paulfiner
  • paulfiner's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 92
  • Thank you received: 1
  • Karma: 1
Hi Tony

Just doing a quick test, it looks like it is only happening on the Multiple questions workaround.
Putting up an alert on a normal question on the next page only gave one alert.

Cheers

Paul
The administrator has disabled public write access.

Re: Quick question about double alert messages 3 years 1 month ago #64718

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

File Attachment:

File Name: limesurvey_group_45.lsg
File Size: 150 KB

Hi Tony,

Thanks for offering, though don't worry if you don't have time or more important/exciting things to do.

I have attached the script.

To make the script work, you'll likely to have change the variable qHiddenTextIDNum1 to the qID of GroupsGroupsHidden (a long-text field at the end of the list).

Sorry about the state of the code, I'm still writing the code and haven't had chance to make it all super clean and pretty yet.

Peter - feel free to use any part of the (rather ugly at the moment) script as the script combines the ability to multiples types of question in an array, add/remove rows, validation colouring (i.e. highlighting rows). This script is probably the simplest that I have but I've got a few others that I've written which have added a few other features (or used existing code from the workarounds).

File Attachment:

File Name: limesurvey_group_45.lsg
File Size: 150 KB



J.
Last Edit: 3 years 1 month ago by doodsonj. Reason: Wrong file
The administrator has disabled public write access.
The following user(s) said Thank You: DenisChenu

Re: Quick question about double alert messages 3 years 1 month ago #64735

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
Okay, got it!

jQuery is getting getting confused when wrapping an element that contains a script. It seems to leave a ghost image of the script so there are effectively two scripts and therefor two $('form#limesurvey').submit() calls.

I see 2 solutions, the first being the easiest to implement and the second making future development far easier (you don't have to mess with the editor):

1) Move the script to the source of the group description.

2) Move the script to template.js and wrap most of it in an IF statement so it only fires when on that page. Something like this:
var qHiddenTextIDNum1 = 1196;
 
if($('#question'+qHiddenTextIDNum1+'').length > 0) {
 
	var myGlobalRows = 10;
	var myGlobalColumns = 3;
	var RowCutOffFreetext = 6;		       
	var RowCutOffHide = 6;
	var RowCutOffHideOriginal = RowCutOffHide;
	var myArrayTableTracker = new Array(myGlobalRows); 
 
	//// And the code continues here....
 
}
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.
Last Edit: 3 years 1 month ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: doodsonj

Re: Quick question about double alert messages 3 years 1 month ago #64740

  • doodsonj
  • doodsonj's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 30
  • Thank you received: 2
  • Karma: 2
Perfect. That has solved everything :) HURRAH, Tony.

I think it is about time that I donate some money to the cause, so I'll get onto that in the next 12 hours :)

As ever, thank you so much for helping me out with my problem.

Peter - if you're implementation is similar to mine, then this solves the problem.

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