Check out the LimeSurvey source code on GitHub!

Use custom fields and Javascript to answer survey questions (especially radiob)

5 years 5 months ago #65652 by ruben1986
I hope anyone can help me with the following:

Some background information:
At the moment I have a list of around 2000 people who are willing to fill in multiple surveys for me.
The survey is not anonymous and we know the following of our list members:

- First name
- Second name
- Email
- Age
- Country
- Gender

To give us a clear view about our audience, we want to filter the survey answers on age, gender and country.
But we don't want to ask our users every time the same information.
Therefore I'm looking for a solution (Javascript) to answer 3 questions automatically.
In the most ideal situation the questions are not visible for the users, but only available in the survey results.

Basically I'm looking for:

- A Javascript to answer a radiobutton (male/female)
- A Javascript to asnwer a radiobutton (select a country)
- A javascript to answer a radiobutton (select a age group e.g. 18-21 or 21-25)

All should be invisible for the users but must be visible when analyzing the survey results.

At the moment I'm able to use the custom fields in answers using the following script and a text field answer:

<script type="text/javascript">
$(document).ready(function() {
$("#answer{SGQ}").attr("value", "{TOKEN:ATTRIBUTE_1}");


It results in a pre-filled answer, but sill visible for the user...

Who can help me finding a solution?


Please Log in to join the conversation.

5 years 5 months ago #65703 by DenisChenu
Maybe you can trye


But you can have a link to the token table, when you export you have the possiblity to export token attribute too. Then i don't think you have to fill the answer like that.

When i use this workaround, is to ask confirmation to the user. :)


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

5 years 5 months ago #65850 by Mazi
If you enter the according information at the token table of an initial survey you can then copy all that token data to other surveys.
Once a user filled out the survey and the survey is set to be non anonymous you can export answer data + token data to have it all within the same Excel file which you can then process for data analysis.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form