Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Create tokens out of our database?

Create tokens out of our database? 2 years 6 months 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.

Re: Create tokens out of our database? 2 years 6 months ago #65788

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5275
  • Thank you received: 289
  • Karma: 246
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: 2 years 6 months 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? 2 years 6 months 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.

Re: Create tokens out of our database? 2 years 6 months ago #65792

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5830
  • Thank you received: 711
  • Karma: 220
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.

:)
The administrator has disabled public write access.

Re: Create tokens out of our database? 2 years 6 months ago #65820

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5275
  • Thank you received: 289
  • Karma: 246
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.

Re: Create tokens out of our database? 2 years 6 months ago #65881

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5830
  • Thank you received: 711
  • Karma: 220
The administrator has disabled public write access.

Re: Create tokens out of our database? 2 years 6 months ago #65958

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5275
  • Thank you received: 289
  • Karma: 246
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.

Re: Create tokens out of our database? 2 years 6 months ago #65968

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5830
  • Thank you received: 711
  • Karma: 220
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".
:)
The administrator has disabled public write access.

Re: Create tokens out of our database? 2 years 6 months ago #65970

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2442
  • Thank you received: 254
  • Karma: 94
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.

Re: Create tokens out of our database? 2 years 6 months ago #65972

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5830
  • Thank you received: 711
  • Karma: 220
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.
Last Edit: 2 years 6 months ago by DenisChenu.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.232 seconds
Donation Image