- Posts: 29
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Disable/Hide Submit Button if No got clicked
- McTell
- Topic Author
- Offline
- Junior Member
Less
More
6 years 2 months ago #162566
by McTell
Disable/Hide Submit Button if No got clicked was created by McTell
Hey,
I know there are plenty of threads already on this topic, but for some reason the condition for hiding a button (Yes/No Buttons) is not working:
Excerpt for yes:
although it is an input element with the class radio and has a value attribute with "Y" ... Any ideas why this is not working?
What works is that:
But since the ids are LimeSurvey generated this approach is not very sustainable...
Any ideas?
I know there are plenty of threads already on this topic, but for some reason the condition for hiding a button (Yes/No Buttons) is not working:
Excerpt for yes:
Code:
$('input.radio[value="Y"]').click(function(){ ...
although it is an input element with the class radio and has a value attribute with "Y" ... Any ideas why this is not working?
What works is that:
Code:
<script type="text/javascript"> $(document).ready(function() { // Initially disable the Next/Submit button $('#movesubmitbtn').hide(); // Listeners on Yes/No radios to toggle the Next/Submit button $('#label-answer535778X13268X208195Y').click(function(){ $('#movesubmitbtn').show(); }); $('#label-answer535778X13268X208195N').click(function(){ $('#movesubmitbtn').hide(); }); }); </script>
But since the ids are LimeSurvey generated this approach is not very sustainable...
Any ideas?
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
6 years 2 months ago #162567
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 Disable/Hide Submit Button if No got clicked
LimeSurvey version?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- McTell
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
6 years 2 months ago #162569
by McTell
Replied by McTell on topic Disable/Hide Submit Button if No got clicked
Version 2.72.5+171121
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
6 years 2 months ago #162570
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 Disable/Hide Submit Button if No got clicked
You can use the Expression Manager {SGQ} placeholder to dynamically pipe in the IDs.
Code:
<script type="text/javascript"> $(document).ready(function() { // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').hide(); // Listeners on Yes/No radios to toggle the Next/Submit button $('#label-answer{SGQ}Y').click(function(){ $('#movenextbtn, #movesubmitbtn').show(); }); $('#label-answer{SGQ}N').click(function(){ $('#movenextbtn, #movesubmitbtn').hide(); }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- McTell
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
6 years 2 months ago #162576
by McTell
Replied by McTell on topic Disable/Hide Submit Button if No got clicked
Neat! It works. And it’s working great with the property disabled "effect"
Code:
<script type="text/javascript"> $(document).ready(function() { // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').prop('disabled', true); // Listeners on Yes/No radios to toggle the Next/Submit button $('#label-answer{SGQ}Y').click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', false); }); $('#label-answer{SGQ}N').click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', true); }); }); </script>
The topic has been locked.