Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Create tokens out of our database?

Create tokens out of our database? 5 years 1 week ago #65781

Hi,

I work at a gaming company, but I am not a programmer, so be patient with me. ;)

We have a player database (MySQL) and we want a specific in-game event to trigger the player to be forwarded to a survey. Is it possible to send our internal database entries (like username, userid, etc.) to create a token for that specific user so that we can later identify them by their username or userid?

I hope you know what I mean... ;)
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65788

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
You don't even need to use tokens but can pass the according values into the survey by URL, see docs.limesurvey.org/tiki-index.php?page=...using_the_survey_URL

If you want to pass the information into the survey but hide it from the user you have to hide the question using Javascript. Therefore you first have to disable the internal <a href='docs.limesurvey.org/tiki-index.php?page=...al+settings#Security'>XSS</a> filter at the admin section (global settings -> security -> "Filter HTML for <a href='docs.limesurvey.org/tiki-index.php?page=...al+settings#Security'>XSS</a> = 'no'").
Then you ahve to edit the according question. Edit the question text in source code mode and add this snippet at the end of the text:
<script>
   $(document).ready(function() 
   {
      $('#question4444').hide();
   });
</script>
You have to replace the question ID ("4444") with the ID of the current question .

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'"
Last Edit: 5 years 1 week ago by Mazi. Reason: SOURCE CODE CORRECTED
The administrator has disabled public write access.
The following user(s) said Thank You: Christian_Bytro

Aw: Re: Create tokens out of our database? 5 years 1 week ago #65791

So, basically we create an additional question, prefill it with the user name or the user id and then hide it so that the user won't see it.
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65792

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9352
  • Thank you received: 1340
  • Karma: 386
Mazi wrote:
If you want to pass the information into the survey but hide it from the user you have to hide the question using Javascript..
I think you can use "Always hide this question" to yes.

Using javascript only to fill the question with other answer.

:)
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65820

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
Shnoulle wrote:
Mazi wrote:
If you want to pass the information into the survey but hide it from the user you have to hide the question using Javascript..
I think you can use "Always hide this question" to yes.

Using javascript only to fill the question with other answer.

:)
Shnoulle, please test your suggestion.
I think this doesn't work because when using the quesion attribute to hide the question the HTML for the question isn't generated at all so populating that question will fail?!

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.

Create tokens out of our database? 5 years 1 week ago #65881

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9352
  • Thank you received: 1340
  • Karma: 386
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65958

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
Mazi wrote:
Shnoulle, please test your suggestion.
I think this doesn't work because when using the quesion attribute to hide the question the HTML for the question isn't generated at all so populating that question will fail?!
One point for you.

I often mix this up. So to be more precise, you can use the "always hide this question" if you fill the answer by URL. Because in this case the GET values from URL seem to be read and put into the session at survey start.

I think you should NOT use the "always hide this question" feature if you try to fill a hidden question by using some Javascript.

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.

Create tokens out of our database? 5 years 1 week ago #65968

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9352
  • Thank you received: 1340
  • Karma: 386
Mazi wrote:
I often mix this up. So to be more precise, you can use the "always hide this question" if you fill the answer by URL. Because in this case the GET values from URL seem to be read and put into the session at survey start.
Exactly,

With newtest at Y:
  1. create the session SGQA
  2. Fill the session SGQA with default value
  3. Fill the session SGQA with URL


I don't think there are other utility to use "always hide this question".
:)
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65970

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5176
  • Thank you received: 769
  • Karma: 230
Yeah, this feature is a little confusing and causes a lot of headaches I think.

So, to sum it up (please correct me if I understood it wrong):
If you want to save variables in the database, that are passed on by the URL, then use the feature "always hide this question", when you need to save something from within the survey, then you need to hide the questions via CSS or Javascript, right?

It would be great to have a better "hide" handling. A lot of more complicated surveys rely heavily on hidden questions to pass on calculations or other info.

In general I find the Limesurvey system with display group by group, question by question or all in one a little unflexible. OK, you can always "violate" question groups to use them as "pages", but this is not ideal.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Create tokens out of our database? 5 years 1 week ago #65972

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9352
  • Thank you received: 1340
  • Karma: 386
I think hide option can hide completly question.

But i think too there are a best method to hide the question with css.

I think a global option like "mandatory" question with:
more question class

Then the user can put 'hide' in this question class and in the template:
{QUESTIONESSENTIAL} put id and class of the question.

PS: And we can use class for other javascript workaround.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
Last Edit: 5 years 1 week ago by DenisChenu.
The administrator has disabled public write access.

Create tokens out of our database? 5 years 6 days ago #66007

Thanks, guys. You really helped me out. Our programmers used the javascript solution and it seems to work. Now we just have to start a survey with real users and see if it works under normal circumstances.
The administrator has disabled public write access.

Create tokens out of our database? 5 years 6 days ago #66010

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

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.

Create tokens out of our database? 5 years 6 days ago #66018

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 83
  • Karma: 37
holch wrote:
So, to sum it up (please correct me if I understood it wrong):
If you want to save variables in the database, that are passed on by the URL, then use the feature "always hide this question", when you need to save something from within the survey, then you need to hide the questions via CSS or Javascript, right?

It would be great to have a better "hide" handling. A lot of more complicated surveys rely heavily on hidden questions to pass on calculations or other info.

holch - Expression Manager in LimeSurvey 1.92 will solve this problem. There is a new question type called "Equation" which is always processed (as long as it is relevant) even if you set "always hide this question", and the result is stored in the database. Basically, we're separating the ideas of relevance (whether the questions should be enabled), and visibility (whether you can actually see it).
holch wrote:
In general I find the Limesurvey system with display group by group, question by question or all in one a little unflexible. OK, you can always "violate" question groups to use them as "pages", but this is not ideal.

Can you say more about what you mean by this? What would you want to see instead?
The administrator has disabled public write access.

Create tokens out of our database? 5 years 6 days ago #66022

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5176
  • Thank you received: 769
  • Karma: 230
I find it more flexible to separate the display of the questions from the display of groups.

I know other tools that offer to group questions (as for a logical group), but also provide the posibility to arrange questions on pages. If you want to control which question is shown on which page at the moment you have to group them in the same group. This can make sense for some surveys, and might not make sense for others. You might want to present 2 groups on one page or 1 group over several pages.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Create tokens out of our database? 5 years 6 days ago #66037

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6009
  • Thank you received: 371
  • Karma: 260
The survey designer at the burried old Limesurvey 2.0 version used pages. There was a tab for each survey page and you could add questions to those tabs.
Carsten might be planning to port/implement such a survey builder once the Limesurvey CI versions works smoothly.

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.
  • Page:
  • 1
  • 2
Time to create page: 0.377 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form