«

»

Nov 06 2012

Adding “I agree” button at the beginning of your Limesurvey survey

Sometimes you need participants to agree to certain terms and conditions before starting to take a survey. There is no build-in feature for this at Limesurvey, but we can easily work around this with some lines of JavaScript. Here we go…

1. Turn of XSS filter at Limesurvey

To be able to add custom JavaScript at a certain survey question or text, we first need to disable the internal Limesurvey XSS filter. So when being logged in at Limesurvey go to Global Settings -> Security -> “Filter HTML for XSS” and set it no “No”.

Limesurvey XSS Filter

2. Adding your terms and conditions

Once you have turned off the filter you can add your terms and conditions to your survey’s welcome text. Click the edit icon and select “Edit text elements”. Add your text at the “Welcome message” text box.

 

3. Adding the “I agree” / “I do NOT agree” buttons

When a user calls your survey, he will at first be presented the welcome text holding the terms and conditions. There will also be a “next” button to start the survey and on option to “Exit and clear survey”. So instead of re-inventing the wheel, we simply rename these buttons for the welcome page only.

For this you need to go to show the welcome message in source code mode. You’ll see the terms and conditions you entered previously. Go to the end of that text and add the following code there to rename the buttons:

<script>
 $(document).ready(function()
 {
    $('#movenextbtn').attr('value','I agree!');
    $('.clearall').attr('value','I do NOT agree!');
 });
</script>

Of course, you can change the “I agree!” / “I do NOT agree!” texts if you wish.

The result:
Custom Limesurvey button labels