I am trying to import the data stored in sessionStorage (and have tried localStorage) into an equation question.
The syntax (below) works on my other webpage, but doesn't seem to work in the equation. It generates a "null" result.
Here is the syntax in the equation:
<script>
document.write(sessionStorage.getItem("repnamelp2"));
</script>
NOTE - if I use this javascript, it gives the correct "TESTING" result:
<script>
sessionStorage.setItem("repnametest", "TESTING");
document.write(sessionStorage.getItem("repnametest"));
</script>
but the first one is the one I want working.
You always come through for people here Tony. Thanks.
The second instance shows that LS can access the storage successfully, but I wonder if it has something to do with LS clearing the storage upon loading, but that's way beyond our pay grades.
I will start another topic on a work-around thought I had.
For javascript : always use jquery , replace document.write by $("#anelement").html(sessionStorage.getItem("repnametest")); for example.
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
Hi, Denis, I tried using the code you supplied, but it wasn't working, possibly likely because I don't have the syntax correct.
I have been able to use session.Storage AFTER LimeSurvey loads and been able to "setItem" in one survey and then immediately transfer to the next survey (totally different one) and then use "getItem" to retrieve the information, and it works perfectly. Issue is that I cannot seem to get the information to be used elsewhere in LimeSurvey. Here is the detailed information on my other post:
Can you provide some background information about what you need/want to use this for?
Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
With $("#anelement") : you need an element with id='anelement' .
Maybe best is to upload a litlle survey with 2 group.
ANd something other : don't use equation question : because equation is done in PHP.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.