Welcome, Guest
Username: Password: Remember me

TOPIC: Predefined answers?

Predefined answers? 2 years 6 months ago #66895

Hello,

At the start of my survey, I have a couple of standard questions for identification of the respondent and for categorizing the surveys, such as:
- date
- name of respondent
- designation of respondent
- name of company
- location of company
- wether or not the company has an office in a certain country (Singapore)

I already entered most of this information in the tokens. So it would be 'user friendly' if these questions were already filled in based on the token (and for the date, some automatically generated date). However, if some other person than the one invited to take part is filling in the survey, they should be able to change the data. So my questions are:
- can the data above be filled in automatically, by using the data in the tokens and automatically generated date?
- if so, can these pre-answered questions be changed if someone else fills in the survey?

Thanks for your help!
Sander
The administrator has disabled public write access.

Re: Predefined answers? 2 years 6 months ago #66901

  • Eddie_V
  • Eddie_V's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
date can be done with javascript just as setting questions to readonly if you dont want them to be changed.

Some other forum users I saw are much better with javascript then me so I will let them handle that :)

We also have a couple surveys that use predefined answers such as name, company etc. that application inserts the tokens with SQL into limesurvey and also inserts a couple answers into the answertable so that those questions are filled in before hand and still changeable by the participants. and if the data is not known they are left empty

This ofc is alot of work and the danger is that when you change your survey in limesurvey your database layout may change and the inserts stop working.

if there is a better way of doing this I would also like to know :)
The administrator has disabled public write access.

Re: Predefined answers? 2 years 6 months ago #66911

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5279
  • Thank you received: 289
  • Karma: 246
@1: This can be done using some Javascript. There are some examples at this forum and I think at the manual as well. Keep in mind that your survey has to be NON anonymous.

@2: One approach would be to use conditions and have an initial question "Are you {FIRSTNAME} {LASTNAME} (taken from token table)?" on which you could base the condition for following questions.

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.

Re: Predefined answers? 2 years 6 months ago #66939

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3844
  • Thank you received: 690
  • Karma: 330
To prefill a question with a token value you can use something like this. (modify the SGQA values as required)
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		if($('#answer11111X22X33').val() == '' && '{TOKEN:FIRSTNAME}' != '') {
			$('#answer11111X22X33').val('{TOKEN:FIRSTNAME}');
		}
	});
</script>

You can also use JavaScript to prefill a date question but I would need to know the date format to give you a snippet.

All of these questions would be editable by the respondent.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Predefined answers? 2 years 6 months ago #67006

Hi guys,

Thanks a lot for your replies. Sorry to reply so late, the Microsoft firewall (Forefront TMG) blocked the limesurvey.org site for a while.

I'll check the suggestions about JavaScripts given by you with some colleagues. Would they also work in LimeService? That's what I'm using. If so, where should I enter the scripts?

How about the SQL-option suggested by Eddie? Will that work in LimeService as well? Any comments on the risks of that option?

As for the date: at present, this is a Date-type question, format dd-mm-yyyy. The box does provide a button that shows a dropdown calendar.

Thanks,
Sander
The administrator has disabled public write access.

Re: Predefined answers? 2 years 6 months ago #67007

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5279
  • Thank you received: 289
  • Karma: 246
1. The JS solutions should work fine at LimeService. You can add the JS either at the template.js of your template or at the sorce code of the question/group itself. There is a source code button at the editor.

2. One could call a PHP script using an Ajax call but I'm not sure if you can upload PHP files at the LimeService template editor because of security issues. That might be a problem.

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.

Re: Predefined answers? 2 years 2 months ago #73897

So how can you call a php script using an Ajax call? where should the php script be stored?
The administrator has disabled public write access.

Re: Predefined answers? 2 years 2 months ago #73902

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5279
  • Thank you received: 289
  • Karma: 246
yannischris wrote:
So how can you call a php script using an Ajax call? where should the php script be stored?
When using Limeservice, there might be problems when uploading the PHP files. Contact Limeservice support to ask if this can be done in order to make Ajax calls to a PHP script (and post their answer here).

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.

Re: Predefined answers? 2 years 2 months ago #73905

Isn't this the limesurvey support forum? I thought that the support team is monitoring this forum.
The administrator has disabled public write access.

Re: Predefined answers? 2 years 2 months ago #73915

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5279
  • Thank you received: 289
  • Karma: 246
LimeService has its own support desk for such issues. This is the general Limesurvey support forum.

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.152 seconds
Donation Image