Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Use variables (eg. username) in survey

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174655 by holch
Replied by holch on topic Use variables (eg. username) in survey
I am actually not quite sure what you are trying to do here. Could you explain again what exactly should be happening?

Because the code you wrote checks if the field is empty.

If the field is empty it should write "Leer" (Empty) and if there is already something in there it would write "Gefüllt" (filled). So in the later case it would actually overwrite what is in the field and write "Gefüllt" over it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
5 years 7 months ago #174656 by jelo
Replied by jelo on topic Use variables (eg. username) in survey
Attach your current survey to check for errors. Might be a issue with LimeSurvey, might be a little mistype. Which version of LimeSurvey is used?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • juppix
  • juppix's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 7 months ago #174658 by juppix
Replied by juppix on topic Use variables (eg. username) in survey
I have addidition fields in the database (Additional user infos).

If have some questions and I want that a user could re-open his survey (edit fields after submitting survey).

If a user opens the survey first time I want to provide a "predicted"/prefilled answer (from the database).
Then the user can usethis predicted/prefilled answer or could insert another answer. After that he submitts the survey again.
If he re-opens his survey he should get his old values as answers (not stored from the database).
I hope I could explain it correctly. Or better: read the first 3-4 posts of this topic to understand what I mean ;)

VERSION:
Version 3.14.10+180924
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174660 by holch
Replied by holch on topic Use variables (eg. username) in survey
I have read all of it but it was still not clear what you are trying to do, especially seeing what you are doing.

Once a survey has been submitted, you can't reopen it and edit responses afaik. I think here is the problem.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174661 by holch
Replied by holch on topic Use variables (eg. username) in survey

Or better: read the first 3-4 posts of this topic to understand what I mean ;)

And by the way: I don't appreciate the attitude. We are trying to help here, you should help us to help you. Therefore: I am out.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174664 by DenisChenu
Replied by DenisChenu on topic Use variables (eg. username) in survey

juppix wrote: Thanks! But the input field is empty :-(
Please take a look at the screenhot (attachment).

I nreally don't understand what you want to do …

And here kontactinfo_SQ001 … but since its a default value … it don't work. Just put {TOKEN:ATTRIBUTE_8} like you done after …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • juppix
  • juppix's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 7 months ago #174668 by juppix
Replied by juppix on topic Use variables (eg. username) in survey
I have to apologize for being rude. That was definitely not my vote. My English is not that good.

I have a personallized survey.

Each user gets an email with his own token for the survey.
Now he can fill out the survey and push "submit".
It is possible without problems for the user to open the survey again (re-open with the same token): now he is able to modify (edit) his answers.
This works fine.

Now I want to integrate that the user gets "prefilled" answers if he opens the survey FIRST time. These answers should come out of the limesurvey-users-database (e.g. "{TOKEN:ATTRIBUTE_6}").
This also works fine.
But I just want this behaviour only the FIRST time the survey opens. If the users open the survey 2nd,3rd,... time the "old" (user added) anwers shoud appear.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174672 by DenisChenu
Replied by DenisChenu on topic Use variables (eg. username) in survey

juppix wrote: I…
But I just want this behaviour only the FIRST time the survey opens. If the users open the survey 2nd,3rd,... time the "old" (user added) anwers shoud appear.

It's EXACTLY the prupose of default value …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago - 5 years 7 months ago #174674 by holch
Replied by holch on topic Use variables (eg. username) in survey

I have to apologize for being rude. That was definitely not my vote.

Already forgotten. ;-)

It is possible without problems for the user to open the survey again (re-open with the same token): now he is able to modify (edit) his answers.

You are right, with "Enable token-based response persistence:" and "Allow multiple responses or update responses with one token:" set to "ON" this should be possible.

Thinking about it, this should work. You check if empty, which on the first opening should be the case. Then LS should fill the question with the value from the token. If the respondent opens again, there should be a value, so it should not be empty, so then it should use the very same value.

But I think the "." is wrong. I think subquestions are referenced like this (with underscore), if I am not totally wrong.
Code:
questioncode_subquestioncode

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 5 years 7 months ago by holch.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174681 by tpartner
Replied by tpartner on topic Use variables (eg. username) in survey
As Denis points out, default answers should be used for this. If the question is empty and ONLY IF the question is empty, the default answer will be inserted, otherwise no automatic change is made to the question value.

Have you tried default answers?




Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174683 by holch
Replied by holch on topic Use variables (eg. username) in survey
The screenshot he shows is from the default answer values ("Antwort-Vorgabewerte" in German), so I guess he is trying this already.
The error must be somewhere else. But as we do not have example LSS, it is difficult.

My guess is still that it is because of the underscore he is using in his test (see screenshot).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #174684 by tpartner
Replied by tpartner on topic Use variables (eg. username) in survey
Yes, but there is absolutely no reason to use if(is_empty(xx)...

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose