To execute a dashboard-esque, I have created a “landing page” survey, which contains would contain the information about the various surveys one would want to have their tokenized respondents complete. The following conditions must exist in order for this workaround to function:
- Surveys must be completed one after the other (the respondent won’t be able to pick and choose what order they’ll complete). I think that this can be adjusted. But it’ll have to happen in the jQuery source code of one of the question. So if you don’t know jQuery, you might have a hard time adjusting this condition.
- All surveys MUST be tokenized, and NOT repeatable (1 time use, token can’t be used to submit multiple responses)
I've included some limesurvey structures that you can import and test out. They will work as inactive surveys, but for full functionality, you must activate all three survey's (and follow the instructions below to adjust for your setup).
Overview of Solution:
The solution essentially utilizes a ‘Parent Survey’, which is the survey that you use to send out invitations to respondents, and where respondents start from anytime they want to continue along with their surveys. The ‘Parent Survey’ provides links to many ‘Child Surveys’. These ‘Child Surveys’ utilize the End URL functionality to send the user back to the ‘Parent Survey’ upon completion of the specific ‘Child Survey’. In order to achieve a few processes, we use the Panel Integration functionality to pass thru some data from the Parent to the Child, and then back again.
What does the process look like?
Essentially, the Parent Survey will present with a list of surveys that the participant must complete. If the participant hasn’t completed any listed surveys, the first survey on the list will contain a token link to that specific survey. All remaining survey’s will text requesting the participant to complete the previous survey first before moving on. When the participant clicks on their survey link, the Parent Survey sends two pieces of information to the Child Survey: 1)The id of the specific subquestion related to the Child Survey that the participant just clicked on and 2)The id of the Parent Survey. The reason for the first piece of information is so that the Child Survey knows which question of the Parent Survey to call “Complete”. The reason for the second piece of information is to allow the Limesurvey developer to quickly set up dashboards. Otherwise you would have to hard code the Parent Survey ID in EACH of the Child Surveys, and as developers, it is sometimes better to be lazy.
The participant will then be sent to the Child Survey using the same token that they had on the Parent Survey. Once the Child Survey has been ‘Submitted’, the user is AUTOMATICALLY redirected to the Parent Survey. The Child survey sends two pieces of information back to the Parent survey: 1) The date of the submission of the Child Survey and 2)The question on the Parent Survey that contains the status for that Child Survey.
Upon arriving on the Parent Survey page, the Parent Survey puts the date of completion into the answer field of the Child Survey status. And then redisplays the survey list. The first survey will now show the completion date of the survey that was just completed, and the next survey’s link will become available. This goes on for each survey until all are complete. At which point the Participant may click submit on the Parent Survey, and the whole process is complete. See below for a detailed explanation about how to carry it out.
The Parent Survey
To setup the Parent survey, we only need to create two questions. The first question, named
surveyStatus, is of the ‘Multiple short text’ type. Each subquestion of this question should contain the id of the survey you wish to link to as the ‘code’ and the name (or any other info you wish to have stored) in the ‘Subquestion’
So, for example: say we have a separate survey we wish for the participant to take. The name of the survey is ‘Survey 1’. That survey’s ID number is 823115. We would add a subquestion to the question surveyStatus. I've included a picture in the attachments.
After saving this question, we would move on to create the second question of the Parent Survey, called
surveyTable . This question will be of the type ‘Text display’. Within the source code of this question. We paste the following monstrosity of code. In essence, it uses the information provided in
surveyStatus to create a table of survey names, links to the external survey, and the status of completion for each of those surveys. You MUST adjust the code below for the var surveyServer and replace it with the address for your server, up to, but not including, ‘/index.php/’
Code:
<!-- Create a div within the question to wrap the table that we use to display the links/survey data -->
<div id="survey-table"> </div>
Code:
<script>
//define the survey server address below
var surveyServer = "http:<YOUR_SERVER_ADDRESS> [attachment=11214]Dashboard_Example.zip[/attachment] [attachment=11214]Dashboard_Example.zip[/attachment]/index.php/";
//grab the survey names, survey completion status, and survey numbers from LS
var surveyNames = "{list(that.surveyStatus.question)}";
var surveyAnsArr = new Array();
//we iterate through the listed surveys to gather their responses from the surveyStatus subquestions(the surveys)
//and store them in an array
if(!({count(that.surveyStatus.valueNAOK)}==0)){
surveyAnsArr = "{list(that.surveyStatus)}".split(",");
};
//get the qids for each surveyStatus subquestion(survey)
var surveyQidArr = "{that.surveyStatus.qid}".split(",");
//Survey qid's for subquestions aren't all that easy to tease out, so we get the QID here, and add the LS 'X' delimeter to it for future use
var surveyQid = "X" + surveyQidArr[0];
//Then we get the FULL subquestion id (the qid + the subquestion id)
var surveySGQAs = "{list(that.surveyStatus.sgqa)}".split(",");
//Then we get the survey names that we grabbed above from the surveyStatus.question for use in the table we'll create later
var namesArr = surveyNames.split(",");
var numberArr = new Array();
//have to break out the survey number from the QID....
for(i=0;i<surveySGQAs.length;i++){
sgqa = surveySGQAs[i];
//useing the qid, we tease out what the subquestion id is. Since the survey id is used as the subquestion id, we now have that for use later...
numberArr.push(sgqa.substring(sgqa.lastIndexOf(surveyQid)+surveyQid.length));
};
var lastCompleted = false;
var startNew = true;
var status = "";
$(document).ready(function() {
//this section creates a table with names and links in a way that LS just can't provide easily. THis way we can control the look/feel a little better.
var table = $("#survey-table");
addHtml = "<table><tr><th>Name</th><th>Status</th></tr>";
//create the table and relevant content using the variables above
//We use the names array we created above to create each row of the table that will display the survey name, the survey link, and the status for the participant of that survey
for(i=0;i<namesArr.length;i++){
addHtml += "<tr>";
//if there are no answers available, LS returns nothing, so answer array should be 0 length
addHtml += '<td>'+namesArr[i]+'</td>';
//I go through a series of if statements to determine what to included in the next cell of the table
//I apologize in advance for any and all coding faux pax
//So, if this is the first survey OR (I know it is AND, but this is the logic I think) the last survey wasn't complete. The status of the survey is
//do the one before this before continueing (dummy).
if(!startNew && lastCompleted){
status = "Pending completion of survey above.";
};
//If the answer array has a ZERO index, then NONE of the surveys have been completed by the respondent, So we change the flag to true for 'lastCompleted'
if(surveyAnsArr.length == 0){
lastCompleted=true;
};
//So, let's say that the respondent has answered 2 out of 4 surveys we want them to do.
//IF the number of answers available is GREATER than the survey number we're on, THEN
//we know that we have the answer to this question, and we can store it in the status variable
//which gets printed out in the table. The status is either "start" as a link to the survey, the
//date that the survey was completed, or a message to complete the prior survey's before continueing
if (surveyAnsArr.length-1>i){
status = surveyAnsArr[i];
};
//here we create the link to the respondents other survey's using their tokens. We also pass this survey id to the linked survey
//so the linked survey knows where to go once the respondent has completed it.
if(lastCompleted && startNew){
//create link text here
//server address + the survey id that we want to go to + the token for this respondent + LS junk + the subquestionid that this link is connected to + the this survey id, so that
//the survey that we're linking to knows where to go after it is complete (this saves the LS developer from having to handcode the survey id into each of the surveys required)
status = '<a href="'+ surveyServer + numberArr[i] + '?token='+ '{TOKEN:TOKEN}' +'&newtest=Y&lang=en&qcode='+ surveySGQAs[i] +'&returnSurvey=' + {SID} + '">Start</a>';
startNew = false; //now that we've reached the next survey that must be completed, all future sureys on the lists should not have a link
};
//if the response array matches this particular question, then it was already completed, so we can set
//the status to the completed date stored in the response array
if(surveyAnsArr.length-1==i){
lastCompleted=true;
status=surveyAnsArr[i];
};
addHtml +='<td>' + status +'</td></tr>';
};
addHtml += "</table>";
//add the table to the table wrapper we created at the beginning of this hot mess.
$(table).html(addHtml);
});
</script>
Next, you should initialize the Survey Participants token table.
At this point we are done with the Parent Survey.
The Child Survey(s)
Now, within the external surveys that you’ve listed in the Parent Survey’s surveyStatus question, you must edit the following survey settings (the external survey can actually already be a live survey for this to occur, I believe)
Within each Child Survey, open the Child Survey’s properties, and choose to edit the ‘General Settings and Text’. Then adjust the settings in the panels listed below according to the instructions:
Adjust the ‘Presentation and navigation’ settings
- Click on the ‘Presentation and Navigation’ panel.
- Find the setting called ‘Automatically load URL when survey complete’, and turn it ON
Adjust the ‘Notification & data management’ settings
- Click on the ‘Notification & data management’ settings
- Find the setting called ‘Participant may save and resume later’, and turn it ON
Adjust the ‘Tokens’ settings
- Click on the ‘Tokens’ panel
- Turn all of the setting’s off EXCEPT for the ‘Enable token-based response persistence’. Turn that one ON
Adjust the ‘Panel integration’ settings
- For each of the instructions below, unless you adjust the code we pasted in the Parent Survey, you MUST use what is written verbatim. Failure to do so will result in, well, failure.
- Click on add URL parameter
- Name the parameter ‘qcode’
- Leave the Target question as “No target question”
- Click on the add URL parameter again
- Name the parameter as ‘returnSurvey’
- Leave the Target question as “No target question”
Now, find the ‘End URL’ field that should be in the ‘General Text Settings’ (or something like that)
You will need to hard code the end URL. However, once you hard code it in one survey, you can just copy/paste it into all other Child Surveys. The format for the URL goes like this:
https://
<”YOUR_SERVERS_ADDRESS”>/index.php/{PASSTHRU:returnSurvey}?token={TOKEN:TOKEN}&newtest=Y&lang=en&{PASSTHRU:qcode}={date("Y-n-j")}
The only two pieces of information you must provide is the server address that you use for your surveys, and OPTIONALY you can change the format of the date that will be sent back to the Parent Survey to mark the date that the survey was completed. If you want to know HOW to format it, you may just look up on this page:
php.net/manual/en/function.date.php
Next, you should initialize the Survey Participants token table.
Repeat all the steps for each Child Survey you’ve included in the Parent Survey surveyStatus question.
Once you’re done – you are ready to send out survey’s with a dashboard-esque appearance.
Generating Tokens
The premise of this setup is the matching of tokens across all surveys. In order to achieve this, you must create a list of participants and either create your own tokens and upload the list to the Parent Survey AND each of the Child Surveys. OR, you can upload the list to the Parent Survey, then have Limesurvey generate the tokens for you, and then export the Participant list from the Parent Survey, and subsequently upload it to all linked Child Surveys.