How to place a certain option at the end of a list with randomized answers at Limesurvey survey

Randomizing answer items is an often used approach at scientific surveys and market research. At Limesurvey this can easily be done. Just go to the advanced question settings of a certain question and then set “Random order” to “Randomize on each page load“.
But often such a list contains an option like “Don’t know” or “None of these” or similar. Such an option may appear in the middle of the list of answers if they are randomized and that looks confusing to the user.

In order to place a certain answer item at the bottom of a randomized list, add the following JavaScript code at your question text, using the source code mode of the editor:

Source code mode:
Source code mode of integrated Limesurvey editor


<script type='text/javascript'> 
/* Place option 5 at the end of the randomized list */
$(document).ready(function() {
var move_element="5";
/* Please do NOT change the lines below */
var move_element="javatbd{SGQ}"+move_element;
$("#"+move_element).insertAfter("#question{QID} .answers-list .answer-item:last-child");

This script snippet will move answer item 5 to the end of the randomized list. “5” is the answer code of the to be moved item.

You want to re-order the “other” option? No problem, we have explained this at How to re-order the “other” option at a Limesurvey survey.

How to disable the Limesurvey “ComfortUpdate” updating feature

Especially after a new version was released, there can be lots of new bug fix releases within a short time for a new Limesurvey version. These “New release available” messages always pop up after having logged in at the admin interface and it can get a little annoying to get rid of them by clicking [x] at the pop-up message all the time.

If you want to globally turn off the ComfortUpdate feature so there are no more update checks and messages popping up, you can edit the config.php file at /limesurvey/application/config. Don’t forget to create a backup first!

At the end of the file you should find the following settings:

Limesurvey config file


To disable the update feature we have to set the “updatable” setting to false. To do so, add a comma after the ‘debugsql’=>0 setting and add another line:

'updatable' => false

The full last block of the config.php file should then look like this:

// Use the following config variable to set modified optional settings copied from config-defaults.php
 // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
 // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
 // on your webspace.
 // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
 'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
 'updatable' => false

You can check if the updater was disabled by going to Global Settings -> ComfortUpdate. There you should get the following message: “…comfortUpdate is disabled in your LimeSurvey configuration.”

Introducing “OfflineSurveys” – The Limesurvey Android app

We have often been asked if there is or will be a Limesurvey app and we always had to answer “no”. Up to now the best approach for running Limesurvey on a mobile device was to design your survey properly and use a mobile optimized Limesurvey template so it scales nicely on smaller screens. Since an Internet connection may not be available all the time in certain areas, this could lead to serious problems with surveys being only partially answered or data being lost on submit.

The solution to this is “OfflineSurveys“, an Android app that let’s you take any Limesurvey survey using your Android device even if no Internet connection is available. Thus, it can easily be used for collecting data on location (e.g. mystery shopping) or interviewing people who used a certain service/visited a certain store, …
It is also a perfect solution for kiosk surveys to collect feedback at restaurants, service centers or exhibitions because the app allows to lock the device and sync data later.

The app caches a LimeSurvey online survey and creates on offline version which stores responses on the local device. Data collected offline can later be emailed or exported to your PC. The PRO version supports automatic response synchronization.

OfflineSurveys supports all LimeSurvey question types, Expression Manager features and conditions, placeholders, … and most other LimeSurvey features. It even offers several additional Android multimedia question types to e. g. take a picture, record a voice note or store the current GPS location.

The free version already supports all these additional question types. It can be downloaded at the Google Play Store. For professionals a customized PRO version can be created.

Feel free to check the website at for more details like features or FAQs.

Here are some screenshots of how surveys look like at the app and which additional Android questions the app offer:

How to remove the “Exit and clear survey” button from a Limesurvey template

While you can easily remove the “Resume later” button from your Limesurvey template by de-activating the “Participant may save and resume later?” feature at “General Settings” -> “Notification & data management” of your survey, removing the “Exit and clear survey” button isn’t possible this way. So what to do?

There are two solutions, both require editing the current template so make sure you have sufficient rights for this. And of course, creating a backup first never hurts 🙂

Using CSS to remove the button

At the Limesurvey template editor select the “template.css” file and at the end add this CSS code to hide the button:

#limesurvey .clearall
   display: none;

For testing we used the <commercial_mode_on>beautiful Limesurvey template “Janus” which you can download here</commercial_mode_off>. This is how the buttons look like before the above adjustment:

with button

…and with the hidden button the result is:

without button

Removing the button placeholder from template code

The solution we recommend to use is to just remove the button placeholder from the template code. While hiding the button using CSS can cause side-effects and users can still use it when setting the browser to display hidden elements, simply removing the code from the template also does the trick.

To do so go to the Limesurvey template editor and at the “Standard files” section select the “navigator.pstpl” file. That’s where we have placed the related code for all templates from our shop.
You should see the following code at which you can simply remove the {CLEARALL} placeholder:

<div id="navigator" class="clearfix">
   <div id="left">
   <div id="right">
   <div id="middle">

Alternatively, you can comment out the placeholder so that the related code line reads:

<!-- {CLEARALL} -->

If the above doesn’t work for you and you need further help with adjusting your Limesurvey template just drop us a note.

How to calculate the number of days between a date inputted by the user and the current date

Sometimes you want to find out how many days or years have passed between today’s date and a date inputted by the user at a Limesurvey survey. The process is a little complex but it can be done using the Limesurvey Expression Manager.

Calculating the number of days

Let’s assume there is a question of type “date” at your survey which uses question code “q2”. The user can select any date using the date picker and at the help text you can show a message like “That was X days ago.”.
To calculate the value for X you can use this expression:

{floor((time() - strtotime(q2)) / (60 * 60 * 24))}

This looks a little complex, so let’s have a look at the details:

  • To get the current time stamp we use time().
  • Using the strtotime() Expression Manager function we create a time stamp based on the date inputted by the user at question “q2”: strtotime(q2)
  • That time stamp gets subtracted from the current time: (time() – strtotime(q2))
  • Since we are not interested in the time difference in seconds but want to know about the exact number of days we divide the result by (60 * 60 * 24) because one day has 24 hours with 60 minutes and 60 seconds.
  • Finally, the result is rounded down using the floor() function.

Calculating the number of years

Similar to the above approach you can also calculate the number of years between a certain date inputted by the user and today’s date. The expression for this is:
{floor((time() - strtotime(q2)) / (60 * 60 * 24 * 365))}

Using calculated result within conditions/relevance equations

You can not only use this expression to output the results of the calculation within any (follow up) question but you can also use this code for conditions by entering it at the “relevance equation” field (without “{” and “}”). E.g. you can ask participants for their day of birth and then calculate if they are already 18 years old. If not, you can use conditions to hide certain follow up questions or show them a warning.

Storing calculated result

If you want to store the calculated result all you need to do as adding the expression (with “{” and “}”) at an equation question. You can even hide that question (edit question -> advanced question settings -> “Always hide this question”) and the result will still be stored at the database.

Creating a fully responsive Limesurvey Template

We could probably write 10-12 pages about how to create a fully responsive Limesurvey template but we want to spare you from reading about all the technical details. Instead, we just want to sum up our findings and present you the results.

Several people have spent dozens of hours to create the first fully responsive Limesurvey template. You can test the template at this test survey and buy the “TFR Responsive” Limesurvey template at the Limesurvey Template Shop.

Benefits of using a responsive Limesurvey template

Of course, the biggest benefit of a fully responsive Limesurvey template is easily serving lots of different devices and presenting the survey questions well displayed on each of them. This does not only make your survey look more professional it will also lead to an increased response rate.
Furthermore, a known disadvantage of common Limesurvey templates is the lack of support for touch screen devices such as smartphones and tablets. Using such a device it can be really tricky to click a radio button or tick the small check boxes. Participants being frustrated because of such a badly designed user interface may just close the survey and leave. When using our fully responsive Limesurvey template participants can just click the text of an answer option at single or multiple choice question to mark an item. At array questions we made the whole cell clickable so even on small devices it is really easy to answer the survey questions. In addition to that the display of larger array questions is optimized by using responsive tables which means that a large table gets split up into several smaller ones which display nicely on small screens.

Technical details

The template we created is based on the bootstrap framework which is famous for serving different devices nicely. For supporting high quality images we make use of Retina JS which supports dynamic switching to a high quality version of an image or logo file if a retina display is used by the participant.
A known issue when using small devices is displaying large array questions nicely. We implemented the “No more tables” JavaScript library at our responsive Limesurvey Template which dynamically splits up large Limesurvey array questions into smaller sections which display fine even on very small devices.
Furthermore, we added custom icons and “Open Sans” as a modern font to achieve a pleasant look and feel so that our template doesn’t look as boring as the shipped Limesurvey templates.

Additional information/links

Sounds interesting? -> Check this test survey.

Want to use this fully responsive Limesurvey template? -> Get the “TFR Responsive” Limesurvey template at the Limesurvey Template Shop.

Want to see more high quality screenshots? -> There you go:

Survey design tips & tricks – Part 2

After we had published our “Survey design tips & tricks” recommendations we received a lot of feedback asking if we can continue the list and give some more examples of what one needs to take care of when creating a Limesurvey survey.

So we got some coffee and had a team meeting discussing further issues worth mentioning. Here are 10 more tips & tricks:

11. Be careful when using matrix questions

Matrix – also called array questions – should be used carefully. They are hard to answer for the user if you add too many sub-questions. Recommendation: Repeat headers at larger matrix questions to help users answer such complex questions and keep the sub-questions as short as possible. This setting can be found at the advanced question settings of each array question.

12. Mark keywords in bold

Within lengthy question or answer texts you should mark important keywords in bold. Users are lazy and don’t like reading lengthy texts or explanations. Highlighting the most important parts helps them and improves the completion rate.

13. Force users to agree to terms and conditions

Some surveys may require that the user agrees to certain terms and conditions. There may also be surveys for which you may want them to mark that they have understood important fill-out notes like “I have understood that…X, Y, Z”.

For such cases use multiple choice questions and set the “max answers” question attribute accordingly to force users to check the box of each item (“Please mark all”).

Alternatively, you can add the terms and conditions at the start page and rename the Limesurvey navigation buttons to “I agree / I do NOT agree”.

14. Use conditions/branching

Limesurvey support complex conditions and you should make use of it. No male people want to be asked for their favorite make-up brand and probably only some very few women want to share their opinion about their favorite beer. So how about adding a gender question and only ask such questions the appropriate target group?!

You can even use conditions based on additional token attributes if you are designing a closed survey and information about gender or age is available up front.

Asking users questions they can’t/don’t want to answer is a survey design worst case.

15. Use screen-outs

If you are interested in data of e.g. young people only, don’t waste other peoples’ time. Add a question asking for their age at the very beginning and set a “zero-quota” to screen out people selecting an answer out of range of your preferred age.

16. Use real time data validation

Instead of cleaning up data later make use of Limesurvey’s real time data validation features:

  1. Email addresses can be checked for valid syntax using a regular expression.
  2. Date ranges can be limited by setting a min/max date. Such date ranges can even be set dynamically. Using the Expression Manager you can e.g. set the max date to today’s date.
  3. For numeric input questions you can also set reasonable min/max limits e.g. when asking for height/weight.
  4. When asking for percentage values, set a max value of 100 and make sure the sum is not greater than 100.
  5. You can reference previous answers to set the max of the current question to a value that was entered at a previous question

17. Always use similar scales

You should always use similar scales within a survey. Users will be confused if question 2 uses a 1-7 scale, question 5 uses a 1-5 scale and question 10 uses a scale ranging from 1 to 10. It also makes comparing data far more difficult. So when designing your survey think of scales which you can use for all questions.

In addition to that you should also make sure to never change the direction of scales. Only for certain psychological experiments that may make sense but users may not even notice that so when doing so show them according hints.

18. Use an even number of items for scales

Scales should always use an even number of answers to force users to give a tendency. At a 1-5 scale people tend to marking the “3” answer in the middle which doesn’t really tell you much.

Instead, use an even number of items at your scale like:

“very good” – “good” – “bad” – “very bad”

19. Offer “save and resume later” option

Especially for lengthy surveys you should enable the “save and return later” feature at “Survey Settings” -> “Notification & Data Management”. Users may be interrupted, may have to leave suddenly or may receive a phone call. Offering an option to save their answers prevents them from just closing their browser or suffering from a session time out.

20. Give feedback about the user’s progress

The user should always be aware of his/her progress when answering a (lengthy) survey. Thus, you should always show a progress bar and also offer additional information like “Just some final questions about XYZ and then we are nearly done.” or “This is the last page of questions, we are nearly there.”

Survey design tips & tricks

Designing your own survey is pretty easy when using Limesurvey. Unfortunately, creating a really bad survey is also pretty easy. That’s why we have set up a list of survey design tips & tricks. Based on our experience with more then 100 survey projects per year the following recommendations hopefully help you designing better surveys.

1. Motivate users to raise completion rate

A user being presented with a simple “Please help me by filling out the survey, it will take 10-15 minutes.” will see no benefit in wasting his/her time with this. In such cases an incentive like “All users which fill out the survey completely will be allowed to take part in a lottery and can win one of 5 Amazon vouchers worth 20,00€.” can raise participation and completion rates significantly.

2. Start with simple questions

A survey should never start with complex questions people have problems answering at all. Instead, place very simple questions like demographic questions at the beginning. Everyone can answer those and they present an easy introduction. Once people have started filling in simple data they tend to finishing their work and not closing a survey early.

3. Questions should be clear

This may sound pretty obvious but for every question make sure it is clear and precise, collectively allowing for detailed, unambiguous and meaningful answers.

4. Add screening questions to the start

Nothing is more annoying than having completed several questions asking for complex information and being told later that for certain reasons like your age or gender you were suddenly screened out and are not allowed to complete the survey and maybe receive a certain incentive.

If users need to agree to certain terms and conditions or have to be of a certain age or gender you should always place such screen out questions at the beginning.

5. Add problematic questions to the end

Similar to placing easy questions at the beginning you should place problematic questions (e.g. about illnesses) at the end. People having already completed 80% of your survey will most likely answer such questions as well.

6. The less questions the better

People tend to ask this and that instead of focusing on the really important questions only. Always make sure a certain question is really important. The less questions the higher the completion rate!

7. Use free text questions to ask for additional information

Open questions may reveal unexpected and very worthy additional information. You should add optional text questions at all important parts of the survey, asking users “Is there anything else you want to tell us about XYZ?”. This may lead to important user feedback you would not have received when using closed questions only.

8. Make sure your questions are non-suggestive

Asking users “What is your opinion about XYZ?” uses neutral speech while a question like “Don’t you agree that LimeSurvey is a really great tool?” is a very suggestive question which will cause users give a more positive feedback.

9. Only make the most important questions mandatory

Having to complete a survey at which each question is mandatory can be really painful, especially when it comes to complex matrix questions.

When designing a survey you always need to ask yourself “Is this question important enough to make it mandatory?”. Only the questions related to data you really need should be mandatory.

10. Keep questions and answers short and easily readable

Nothing to add to this…


To be continued…


BTW, if you are not very familiar with designing surveys but need to create an important one, we can help with that. Our experience can help you creating a great survey with a high completion rate.
Just drop us a note if we should review your survey or set it up for you.