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

How to Insert Answer via Javascript - by: tpartner

$
0
0

Basicly, I need to copy the values to Limesurvey's text input and make Limesurvey recognize the value/input.

I have already explained how to do that above.

Survey questions relationship, how to? - by: tpartner

Single Choice from Pictures - by: tpartner

$
0
0
If using a list-radio question type, there is a question theme specifically for this.

Update age automatically using Equation type question, using Date of Birth - by: DanielVN

$
0
0
Thank you very much, Tony.

Just wanted to double check before aplying this setup to the survey.

Cheers
Daniel

Question validation equation error - by: tpartner

$
0
0
Your sample question seems to work as expected for me. Initially, there is no red border but the warning text is red as it should be because the question is unanswered.

Conditional redirect to another survey - by: tpartner

Finding respondents who don't belong in the survey - by: vadikcoma

Log-off from survey - by: holch

$
0
0
So you are talking about survey respondents, not backend users?

Survey respondents are never really logged in, so you can't really log-off.

The button you are looking for already exists. It's the little [x] in the top right corner of the browser. ;-)

Why do you need this log-off button, what are you expecting as benefits?

Conditional setting based on set of questions - by: jimdavies

$
0
0
Thanks, I was able to get it to work. I appreciate your help and patience!

Transfer token value to second survey - by: DanielVN

$
0
0
Hi All,

I have setup a survey with public registration that will serve as a survey collecting basic demografic information about the respondents. Once the respondent completes the first survey i would like to redirect them to a second survey where I will ask them additional questions. I don't want the surveys to be very long and this is the reason why i have split them.

Since the first survey is asigning random tokens to each respondents i would like to pass the token value to the second survey so I can match the data from both surveys.

Could you please advise if there is a way to do it?

Also is there a way to set the automaticallt generated tokens to have only numeric values instead of alpha-numeric as it is currently?

FYI I'm using limesurvey Version 2.73.0+171219

Transfer token value to second survey - by: holch

$
0
0
How are the tokens created? By Limesurvey or by yourself?

If it is a Limesurvey token you can usually acess the token via {TOKEN}. Give it a try and post this in a question text, just to see if it works.

You can then use this to add the token to the end url for the second survey and use the panel integration feature to store the token that has been transmitted via the URL into a text question.

Transfer token value to second survey - by: holch

$
0
0
I don't think you can change the way the tokens are generated without hacking the core of LS.

No idea why it is not storing your token in the second survey. You might have hidden the question via the "always hide" feature. It might not work with this, but you might have to hide the question via CSS class. Give it a try, don't hide the question and see if your token appears and is saved to the database. Then hide via "Always hide" and via CSS and check what happens.

How to Insert Answer via Javascript - by: b1994mi

$
0
0
I see, I have it working with short free text question.. It seems that I have to use jquery rather than javascript and put the .trigger('keyup') in one line with assigning the .value(whatiwant).

Thank you for your help, it is very much appreciated. :D

Conditional setting based on set of questions - by: holch

$
0
0
You can, but you are referencing the subquestions wrong.

You need to tell Limesurvey which question you are referring to and which subquestion you are referring to. AS So what is the question code of this array question? Because Q12-Q16 seem to be the subquestion codes.

So to reference the subquestions you need to go like this QUESTIONCODE_SUBQUESTIONCODE. If you would use numbers for the answer codes you could shorten your equation quite a bit by use >, < and = to define everything in one.

Lets assume you want to reference the subquestion Q12, lets assume the question code of the whole question is QC and the answer options are 1-5 and you only want 1-3 go further.

Then you could write something like this:

If you put this into the long free text question as relevance equation, the question would open if the respondent answere 1, 2 or 3 in subquestion Q12 of question QC.

If you really want to stick to your current answer codes it will be more or less the same, you just will have to have a longer relevance equation.

How to Insert Answer via Javascript - by: b1994mi

$
0
0
Hi, it seems that I still have some trouble with the same thing.



Now, I have tried using
$("#answer{SGQ}SQ001").val(result.geometry.location.lat()).trigger('keyup');
but it did not change the value of answer. It only changed the text input field.



I also found out that I can not even make the text field to change the value using this line
//this does not seem to work, the value of the text field do not change :(
$("#answer{SGQ}SQ003").val(carikodepos.long_name).trigger('keyup');
How is so?

I am really confused as I have no prior experience with HTML, javascipt, nor JQuery. :(



This is what it looks like when I insert the address from the text input and clicking the autocomplete form (geocomplete):

Notice that the whole input text changes, but hte answer is not yet recognized by Limesurvey.



And this is what it looks like after I drag the marker on the map:

The lat, lng, and the top input text changes but the address and postalcode does not change. Also, the answer have not yet recognized by Limesurvey.



What am I doing wrong? :dry:



Here is my full code:
<label>Where do you live?</label>
 
<!--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>
 
<!--Show input text field for address using Limesurvey style-->
<div class="ls-answers answer-item text-item ">
  <input class="form-control " id="mailcompletegeser" style="" type="text" value="" />
</div>
 
<!--Division for the map canvas-->
<div id="map_canvas" style="width:100%; height: 350px;"> </div>
 
<!--call necessary scripts-->
<script src="http://maps.googleapis.com/maps/api/js?libraries=places&amp;key=AIzaSyD0v6cdUflFKKxeUzzQWn1t2kriR57nf1s"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></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>
$(document).ready(function(){
 
  //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
  $("#mailcompletegeser").geocomplete(options).bind("geocode:result", function(event, result){
    var map = $("#mailcompletegeser").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
  $("#mailcompletegeser").bind("geocode:dragged", function(event, latLng){
    var map = $("#mailcompletegeser").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"){
            //this does not seem to work, the value of the text field do not change :(
			$("#answer{SGQ}SQ003").val(carikodepos.long_name).trigger('keyup');
          }
        }
        var alamat = results[0].formatted_address;
		//neither does this one, it does not change the text field
        $("#answer{SGQ}SQ004").val(alamat).trigger('keyup');
        $("#mailcompletegeser").val(alamat);
      }
    });
  });
});
</script>

Single Choice from Pictures - by: KMB_Janine

Update age automatically using Equation type question, using Date of Birth - by: DanielVN

$
0
0
Hi Tony,

Thank you. Is there a way to change the data once stored using some kind of script?

Best regards
Daniel

Update age automatically using Equation type question, using Date of Birth - by: tpartner

$
0
0
No, there is no way to do that from within LimeSurvey. I suppose you could use a remote PHP script to manipulate the database directly but that's out of the scope of this forum.

Log-off from survey - by: holch

$
0
0
But what should the "log-off" button do, if they are not really logged in? Just redirect them back to the token form screen?
You probably can do this simply by inserting a link to the token screen.
If you feel this needs to really look like a button, you can format links so they look like buttons via CSS.
Or you insert a button with a javascript function that redirects to the token form screen.
Just a few ideas.

How to Insert Answer via Javascript - by: b1994mi

$
0
0
Hi,

I have attached below my survey with only the question that I am having trouble with. What I am trying to accomplish is to ask respondents where they live as user friendly as possible and I need to store the coordinates, the postal code, and the complete address form. The rest of the survey is just a stated preference transportation study, asking people about prices, etc.

The built-in map, both gmaps and openstreet map, included in Limesurvey is not user friendly enough. So, I stumbled upon this Ubilabs Geocomplete solution, but I have not net been able to make things work the way I need it.

I hope you could help me out of this. :)

Sincerely,
b1994mi
Viewing all 17529 articles
Browse latest View live