Welcome, Guest
Username: Password: Remember me

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

Use custom fields and Javascript to answer survey questions (especially radiob) 3 years 2 months ago #65652

  • ruben1986
  • ruben1986's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
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}");
$("#answer{SGQ}").style.display='none';

});
</script>

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

Who can help me finding a solution?

Thanks!
The administrator has disabled public write access.

Re: Use custom fields and Javascript to answer survey questions (especially radiob) 3 years 2 months ago #65703

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6551
  • Thank you received: 868
  • Karma: 257
Maybe you can trye

$("#questionXXX").hide();

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. :)

Denis
The administrator has disabled public write access.

Re: Use custom fields and Javascript to answer survey questions (especially radiob) 3 years 2 months ago #65850

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
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)limesurvey.org'"
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.123 seconds
Donation Image