- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can I use Javascript to trigger save/submit page
- maxrandolph
- Topic Author
- Offline
- New Member
Less
More
7 years 7 months ago #141739
by maxrandolph
Can I use Javascript to trigger save/submit page was created by maxrandolph
This is a follow-up to my previous question regarding submit buttons on every question page.
I've been attempting to save the answers on a page by clicking an html element within a question. I have tried using:
document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();
as the onclick event, but does not seem to save the answers unfortunately. Is there a javascript method I can call to save the current answers?
Thanks.
Here is my current code:
I've been attempting to save the answers on a page by clicking an html element within a question. I have tried using:
document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();
as the onclick event, but does not seem to save the answers unfortunately. Is there a javascript method I can call to save the current answers?
Thanks.
Here is my current code:
Code:
<h1 onclick="myFunction()">submit</h1> <script type="text/javascript" charset="utf-8"> function myFunction() { if($('#movesubmitbtn').length > 0) { document.limesurvey.move.value = 'movesubmit'; } else { document.limesurvey.move.value = 'movenext'; } document.limesurvey.submit(); }; </script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
7 years 7 months ago - 7 years 7 months ago #141743
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can I use Javascript to trigger save/submit page
Try something like this to click the "Next" button.
Code:
$('#movesubmitbtn, #movenextbtn').trigger('click');
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 7 months ago by tpartner.
The following user(s) said Thank You: maxrandolph
The topic has been locked.
- maxrandolph
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
7 years 7 months ago #141770
by maxrandolph
Replied by maxrandolph on topic Can I use Javascript to trigger save/submit page
Exactly what I needed. Thank you again so much.
The topic has been locked.