Check out the LimeSurvey source code on GitHub!

Create tokens out of our database?

More
5 years 4 months ago #65781 by Christian_Bytro
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... ;)

Please Log in to join the conversation.

More
5 years 4 months ago - 5 years 4 months ago #65788 by Mazi
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)survey-consulting.com'"
Last Edit: 5 years 4 months ago by Mazi. Reason: SOURCE CODE CORRECTED
The following user(s) said Thank You: Christian_Bytro

Please Log in to join the conversation.

More
5 years 4 months ago #65791 by Christian_Bytro
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.

Please Log in to join the conversation.

More
5 years 4 months ago #65792 by DenisChenu

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 development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 4 months ago #65820 by Mazi

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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 4 months ago #65881 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 4 months ago #65958 by Mazi

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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 4 months ago #65968 by DenisChenu

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 development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 4 months ago #65970 by holch
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.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 4 months ago - 5 years 4 months ago #65972 by DenisChenu
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 development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 5 years 4 months ago by DenisChenu.

Please Log in to join the conversation.

More
5 years 4 months ago #66007 by Christian_Bytro
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.

Please Log in to join the conversation.

More
5 years 4 months ago #66010 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 4 months ago #66018 by TMSWhite

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?

Please Log in to join the conversation.

More
5 years 4 months ago #66022 by holch
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.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 4 months ago #66037 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form