I have a one-page survey, and am experiencing that answers are not stored, unless the "Submit"-button at the bottom is clicked (which, surely, is the expected survey behavior). However, is there a way to ensure that answers are collected, even when the respondent refreshes the browser to start over - instead of clicking the button? Could one collect answers in real time, for example?
Alternatively, how could I create a second button at the top of the survey, which would also serve as a way to complete it and store the entered data? It is not paramount that all fields are filled every time, and the same user will respond to the survey many times, so my main concern is to remove any unnecessary hurdles. I have made an attempt at this, using jQuery:
This successfully completes the survey when I click on "Submit" but, alas, does not store any data. Even though the document.limesurvey.submit(); seemed tailored for the purpose... Is there another function I could use instead? Or do I need to make adjustments to my code? My LimeSurvey version: 2.05+
Thank you, Tony! With this, the data are now stored when I click my button.
Do you have any input on the other part of my question? I have discovered the window.onbeforeunload and window. onload handles, which should fire when the user refreshes the page, though I haven't been able to make these work yet.
The only clean way I see to do this is to have an interval timer periodically make an AJAX call to a remote PHP script that updates the database directly.
Unfortunately, I not in a position to offer any substantial code for a week or more.
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.