Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Save data from hidden question

Save data from hidden question 1 Jahr 3 Wochen her #107243

  • LimeLight
  • LimeLights Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 5
  • Karma: 0
Hi,

I'm generating a GUID via a javascript. I'm printing it to a long textfield. However, when i set the question to "always hide this question" the GUID is not stored among the answers. How can I make the GUID stick to the answer table while still being hidden?

// TIA
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Save data from hidden question 1 Jahr 3 Wochen her #107248

  • holch
  • holchs Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3377
  • Dank erhalten: 457
  • Karma: 148
You can't write to a question which is hidden via "always hide this question" because it does no show up in the HTML code and you can only write with Javascript to a question that is in the HTML code.

What you need to do is hide the question via CSS, thus it is just not shown in the browser, but it is still in the html code and thus read and writable via JS.
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!
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Save data from hidden question 1 Jahr 2 Wochen her #107266

  • boyan
  • boyans Avatar
  • OFFLINE
  • Senior Lime
  • Beiträge: 49
  • Dank erhalten: 9
  • Karma: 1
Alternatively, you can write $("#questionID").hide(); in the question box or help box if you don't want to mess with CSS.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: holch

Save data from hidden question 1 Jahr 2 Wochen her #107268

  • holch
  • holchs Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3377
  • Dank erhalten: 457
  • Karma: 148
I didn't know this one. That is an interesting alternative, because you don't need to make chances to the template css.
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!
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Save data from hidden question 1 Jahr 2 Wochen her #107269

  • TMSWhite
  • TMSWhites Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 759
  • Dank erhalten: 82
  • Karma: 36
If the goal is to have the GUID stored in the database, then you can use an Equation question to do this. Equations are unique among questions types in that their value is always saved to the database even if the always_hidden attribute is set. For all other question types, if the question is hidden by always_hidden, or relevance (e.g. the question is not applicable), then the database stores NULL for that question.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Save data from hidden question 1 Jahr 2 Wochen her #107278

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 7063
  • Dank erhalten: 952
  • Karma: 282
Hi,

@Thomas : hidden => save in DB : default value OR value set by Equation ( Q1="Answer ).

No ability to use javascript

;)
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.155 Sekunden
Donation Image