Save data from hidden question

More
2 years 11 months ago #107243 by LimeLight
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

Please Log in to join the conversation.

More
2 years 11 months ago #107248 by holch
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.

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
2 years 11 months ago #107266 by byan
Alternatively, you can write $("#questionID").hide(); in the question box or help box if you don't want to mess with CSS.
The following user(s) said Thank You: holch

Please Log in to join the conversation.

More
2 years 11 months ago #107268 by holch
I didn't know this one. That is an interesting alternative, because you don't need to make chances to the template css.

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
2 years 11 months ago #107269 by TMSWhite
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.

Please Log in to join the conversation.

More
2 years 11 months ago #107278 by DenisChenu
Hi,

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

No ability to use javascript

;)

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).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.