Quantcast
Channel: Topics in Category: Can I do this with LimeSurvey? - LimeSurvey forums
Viewing all 17529 articles
Browse latest View live

Add Google Analytics goal to completed survey - by: vadikcoma

$
0
0
Hello, is it possible to trigger google analytics goal when survey is submitted?

What is the best way of doing that?

Thank you!

Challenge with API for add_participants, list_participants - by: rabshier1

$
0
0
I am trying to make the add_participants API call using node.js and express. It's adding the participants, but I am not getting the array back in the response from the post. I get an OK code back .

This is not the case with all API calls. I made a copy_survey call and do indeed get the response with the newsid inside. Made the call the same manner as shown below. Any thoughts?

Here's the objective:
  • Activate the participants table (works)
    Activate the survey (works)
    Add Participants (works, but no array returned)
    Send Invitations

I chased an alternative of doing list_participants and sending the emails in a separate route/post. But I am having similar issue here. I get an OK code but no array back when I make the list_participants call also.

Any thoughts to what I have missed? Thanks!!

How to Insert Answer via Javascript - by: tpartner

$
0
0
3 major problems...
  1. You are calling for jQuery while it is already included - this introduces conflicts.
  2. You have inserted an <input type="text"> element that is causing errors with Expression Manager. As stated, you cannot simply add inputs to an existing form. Use one of the sub-question inputs instead.
  3. When using curly braces in a script, that are not for Expression Manager variables, you must insert a white-space after opening braces and before closing braces.

<p><strong>Where do you live?</strong></p> 
<!--to show what the answer looks like-->
<p>self: {self}</p>
<p>SQ001: {yourhome_SQ001}</p>
<p>SQ002: {yourhome_SQ002}</p>
<p>SQ003: {yourhome_SQ003}</p>
<p>SQ004: {yourhome_SQ004}</p>
 
<!--Division for the map canvas-->
<div id="map_canvas" style="width:100%; height: 350px; margin: 20px 0;"> </div>
 
<!--call necessary scripts--> 
<script src="http://maps.googleapis.com/maps/api/js?libraries=places&amp;key=yourKey"></script> 
<script src="http://ubilabs.github.io/geocomplete/jquery.geocomplete.js"></script> 
 
<!--the script that uses geocomplete and insert the values to answer field--> 
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Move the canvas
		$('#question{QID} .answer-container').append($('#map_canvas'));
 
		//Make the answer text field unavailable for user to change the value
		document.getElementById("answer{SGQ}SQ001").readOnly = true;
		document.getElementById("answer{SGQ}SQ002").readOnly = true;
		document.getElementById("answer{SGQ}SQ003").readOnly = true;
		//document.getElementById("answer{SGQ}SQ004").readOnly = true;
 
		//declare and initialize map named 'options'
		var options = {
			country: ["ID"],
			types: ['geocode','establishment'],
			map: "#map_canvas",
			location: [-6.17511, 106.86503949999997],
			mapOptions: {
				zoom: 10,
				streetViewControl: false,
				fullscreenControl: false,
				mapTypeControl: false
			},
			markerOptions: {
				draggable: true
			}
		};
 
		//what to do when the user inputs address and uses the geocomplete form
		$("#answer{SGQ}SQ004").geocomplete(options).bind("geocode:result", function(event, result){
			var map = $("#answer{SGQ}SQ004").geocomplete("map");
			var pcd = "";
			for(var i=0; i < result.address_components.length; i++){
				var component = result.address_components[i];
				if(component.types[0] == "postal_code") {
					pcd = component.long_name;
				}
			}
 
			//input the values to the limesurvey's answer field
			$("#answer{SGQ}SQ001").val(result.geometry.location.lat).trigger('keyup');
			$("#answer{SGQ}SQ002").val(result.geometry.location.lng).trigger('keyup');
			$("#answer{SGQ}SQ003").val(pcd).trigger('keyup');
			$("#answer{SGQ}SQ004").val(result.formatted_address).trigger('keyup');
		});
 
		//what to do when user drags the marker on map
		$("#answer{SGQ}SQ004").bind("geocode:dragged", function(event, latLng){
			var map = $("#answer{SGQ}SQ004").geocomplete("map");
			map.panTo(latLng);
			var geocoder = new google.maps.Geocoder();
			$("#answer{SGQ}SQ001").val(latLng.lat).trigger('keyup');
			$("#answer{SGQ}SQ002").val(latLng.lng).trigger('keyup');
			geocoder.geocode({ 'latLng': latLng }, function(results, status){
				if (status == google.maps.GeocoderStatus.OK) {
					for(var i=0; i < results[0].address_components.length; i++){
						var carikodepos = results[0].address_components[i];
						if(carikodepos.types[0] == "postal_code"){
							$("#answer{SGQ}SQ003").val(carikodepos.long_name).trigger('keyup');
						}
					}
					var alamat = results[0].formatted_address;
					$("#answer{SGQ}SQ004").val(alamat).trigger('keyup');
				}
			});
		})
	});
</script>

Working survey attached:

File Attachment:

File Name: limesurvey_survey_5996171.lss
File Size: 19 KB


Array with large text fields - by: nique

How to Insert Answer via Javascript - by: b1994mi

$
0
0
Wow, thank you very much for your help! I am really greatful for it ^_^

Array with large text fields - by: tpartner

$
0
0
What is your LimeSurvey version?

Array with large text fields - by: tpartner

$
0
0
In that case, this should work:

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
 
		// Identify the questions
		var qArray = $('#question{QID}');
		var arrayLength = $('tr.answers-list', qArray).length;
		var qComments = qArray.nextAll('.text-long:lt('+arrayLength+')');
 
		// Add some classes
		qArray.addClass('array-with-comments-question');
		$(qComments).each(function(i) {
			$(this).addClass('comments-question index-{SGQ}-'+i);
		});
 
		// Insert the comments buttons
		$('table.questions-list col', qArray).removeAttr('width');
		$('table.questions-list thead tr', qArray).append('<td />');
		$('tr.answers-list', qArray).each(function(i) {
			$(this).append('<td><button class="comment-button" type="button" data-index="{SGQ}-'+i+'">Comments</button></td>');
		});
 
		// Put the comments questions into modal dialogs		
		$(qComments).dialog({
			autoOpen: false,
			width: 620,
			modal: true,
			resizable: false,
			draggable: false,
			closeOnEscape: true
		});
 
		// Click events for comments buttons
		$('.comment-button').click(function() {
			var thisIndex = $(this).attr('data-index');
			$('.comments-question.index-'+thisIndex).dialog('open');
		});	
 
		// Interrupt the Next/Submit function (to put comments back in the form)
		$('#movenextbtn, #movesubmitbtn').bind('click', function () {			
			qComments.hide();
			$('#limesurvey').append(qComments);
		});		
 
	});
</script>

Working survey attached:

File Attachment:

File Name: limesurvey_survey_142497.lss
File Size: 30 KB

Adding objects to answer options - by: kpatch

$
0
0
Hello:

I am currently adding audio objects to my question text using code like this:

<audio controls="" preload=""><source src=" mydomain.com/pretest/auralp2/la_peur/lap...onses_orale_q4r3.mp3 " type="audio/mp3" /> Your browser does not support the audio element.</audio>

This is how it appears:



My preference would be to have them embedded in the answer options, like this:




I have used the HTML editor for the answer options to attempt this. None of the toolbar tools seem suitable. Also, in "Source" mode I have tried to use <iframe> but, alas, no joy in LimeVille.


Any suggestions would be most helpful.

Thanks

Patrick

Adding objects to answer options - by: holch

$
0
0
And always state the exact LS version you are using (and ideally also the template/theme).

What happens if you insert the code directly in the answer option text field, without any editor or anything? You usually can just insert HTML (as long as the XSS filter is off).

Adding objects to answer options - by: kpatch

$
0
0
First off, I am using LS Version 3.7.2+180508. I am also using a custom theme ("esprimme") that is an extension of "fruity".

Your recommendation about the HTML/XSS filter did the trick. Worked the first time!

For completeness I have attached the *.lss file of my test survey.

Thank you so much.

Performance: Links vs. LS Resources for image and audio files - by: kpatch

$
0
0
Hello:

Several of my surveys contain a number of image (JPG, PNG) and audio (MP3, WAV) files. They are currently on my server outside of the LS environment.

Some of my users comment about the delay--or failure--of these images and sound files to display. Would the performance improve if they were added to LS as Resources.

Thanks

Patrick

BTW...I am using LS Version 3.7.2+180508 and a custom theme that is an extension of fruity

How do I de-activate a survey using LimeSurvey RemoteControl API? - by: liu_yifan

$
0
0
I created a new survey using .lss exported from an existing survey, but found it does have the participant table coming with it.Since I don't find the API to create the participant table, I tried to import .lsa file instead. This time, the new survey has participant table, but cannot be modified because it's active. So I'm now looking for the API to de-activate a survey. Please help!

Deleting Required Button Without Adding No Answer - by: nicolegarelick

$
0
0
I am struggling with a question in my survey because required notification is popping up for a mandatory multiple choice question. However, when I make the question optional then an option to add in "no answer" pops up in my survey. How can I remove the required notification while avoiding this no answer issue?

Change submit button to next button - by: LouisGac

$
0
0

krosser wrote:

LouisGac wrote: In LS3 you can also do it in a more refined way.
For example, someone could edit the file navigator.twig:
github.com/LimeSurvey/LimeSurvey/blob/ma...ation/navigator.twig

and in the statement to check if the button "submit" should be shown, test if the survey has an endurl going to another survey
github.com/LimeSurvey/LimeSurvey/blob/ma...n/navigator.twig#L45


This sounds nice. I guess it would be {% else %} for the end-url... But what is the syntax for the end-url in twig? I couldn't find it mentioned anywhere to check how it would look like.


dump aSurveyInfo (it's still full of non necessary data), you should find it.

Deleting Required Button Without Adding No Answer - by: tpartner


Ability to add Google Maps as a question - by: tpartner

$
0
0
This looks like a good candidate for a 3.x custom question theme. I'll try to find the time to develop that this week.

Array Question with "Other" Answer - by: DVP17lemon

$
0
0
Thanks @tpartner for this great code!

However, I only wanted to ask if there is also a way to accomplish this without using JavaScript? @DenisChenu has posted something that seems to go into this direction. Unfortunately, it is not fully clear how his example actually works. Does anybody have a detailed explanation of @DenisChenu's post or how to accomplish this without using JavaScript?

How to generate two or more unique random variables? - by: DVP17lemon

$
0
0
ATTENTION! The code above does not give complete random variables, but a slightly skewed distribution of random variables.

However, I have found a better solution to create two unique random variables:

1) Create three random variables (questions of the type equation), e.g. RANDOM, RANDOMTWO, RANDOMINT in this order.
2) RANDOM gets the equation:
{if(RANDOM>=1,RANDOM,rand(1,2))}
3) RANDOMTWO gets the equation:
{if(RANDOMTWO >=1, RANDOMTWO, rand(1,2))}
4) RANDOMINT gets the equation:
{RANDOMTWO=(if(RANDOMTWO==RANDOM, rand(1,2), RANDOMTWO))}
--- to increase uniqueness you simply repeat this formula in the equation like this:
{RANDOMTWO=(if(RANDOMTWO==RANDOM, rand(1,2), RANDOMTWO))} {RANDOMTWO=(if(RANDOMTWO==RANDOM, rand(1,2), RANDOMTWO))} {RANDOMTWO=(if(RANDOMTWO==RANDOM, rand(1,2), RANDOMTWO))} {RANDOMTWO=(if(RANDOMTWO==RANDOM, rand(1,2), RANDOMTWO))}

Fb share - by: fatamorganna

$
0
0
Hello everyone,


I want to share my survey via Facebook but when i add the link in the FB post i get a message that javascript is disabled in my browser (the link to my survey is working fine though). I was wondering if i could get rid of this message because it is a survey via social media and this message is really "unattractive" and i need many participants. Thanks in advance.

Log-off from survey - by: poojadure

$
0
0
Hi holch,

i've added Log-off link on top in the navigation bar and just redirecting them back to the token form, thank you for the ideas. :)
Viewing all 17529 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>