I've been trying various ways of adding a button at the bottom of every question that allows the user to submit and end the survey from any group page. Adding a {SUBMITBUTTON} to the question template gives me a button with a "Submit" label, but the button itself acts like a glitchy Next button.
I've been trying to make a workaround using javascript, but everything I've tried seems to have very glitchy success(seems to work at first then fails 50%-80% of the time).
I see that the next button saves the answers but I was hoping for a button I could add to the end of each group page that would do this and also I guess put that token's associated usesleft to 0 so that a submission is final. The user could not then go back and alter answers.
After thinking about it for a bit and tinkering with javascript within a boilerplate question, I think maybe the best way to do this is have a button within a boilerplate that redirects to an external link that confirms submission and then updates the limesurvey database under the usesleft column.
I guess thinking about it now, that should work, but I guess I was curious of whether there was an internal way of doing this.
Also I've noticed that having an html <button> within a question seems to trigger an event that takes the user to the previous question page, regardless of content. Simply clicking a button with any time of onclick attribute seems to trigger this event.
EDIT:
Just realized this method would only work if I can trigger saving the current page's answers before redirecting to external link. Is there a way to trigger saving the survey answers via javascript?
Thanks.
Last edit: 8 years 7 months ago by maxrandolph. Reason: How to submit with js
Place a hidden radio question on every page (group) and have relevance on every subsequent group based on the hidden question being unchecked.
Use JavaScript to have the fake submit button first click the hidden radio and then the "Next" button. When that happens, all subsequent groups will be irrelevant so the respondent goes directly to the end.
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.