- Posts: 16
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Set Relevance Status using the Expression Manager?
- AGK925
- Topic Author
- Offline
- New Member
Less
More
8 years 5 months ago - 8 years 5 months ago #127817
by AGK925
Set Relevance Status using the Expression Manager? was created by AGK925
Hello,
I would like to know if it is possible to set the relevance status for a question using expressions in a latter question. I would like to hide a question after it has been answered so that the respondent cannot go back and change their answer, we are conducting a choice survey similar to a choose your own adventure book.
Originally I had the following relevance equation for the first question
which worked a bit too well. As soon as I answered the question it was hidden; as it should have been. However, I would like the respondent to have the ability to review their answer before continuing to the next page of questions. I would then like to change the Relevance Status of Q1 to 0 at the start of the next page.
I thought I could include the following code to the first question on the next page
but this seems to have no effect on the relevance status of Q1.
Any help would be greatly appreciated,
Tony
I would like to know if it is possible to set the relevance status for a question using expressions in a latter question. I would like to hide a question after it has been answered so that the respondent cannot go back and change their answer, we are conducting a choice survey similar to a choose your own adventure book.
Originally I had the following relevance equation for the first question
Code:
is_empty(Q1.NAOK)
I thought I could include the following code to the first question on the next page
Code:
{if(is_empty(Q1.NAOK), Q1.relevanceStatus=1, Q1.relevanceStatus=0)}
Any help would be greatly appreciated,
Tony
Last edit: 8 years 5 months ago by AGK925. Reason: update display of code
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 5 months ago #127874
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 Set Relevance Status using the Expression Manager?
As far as I know, you cannot directly set relevance with Expression Manager. A workaround may be to have JavaScript toggle a hidden question when you submit the page with Q1. Then set Q1 to only be relevant if the hidden question is unanswered.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- AGK925
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 3
8 years 5 months ago #127894
by AGK925
Replied by AGK925 on topic Set Relevance Status using the Expression Manager?
Thank you. So if I am understanding your suggestion I should have a hidden question before the first question and the first question should have a relevance equation that is hiddenQ=="". Then using java make an even that sets the answer of the hidden question to the answer of the first visible question which happens when they click the next button? Do you happen to have a link that I could use to reference how to manipulate the hidden question answer based on a radio button selection? Also, when I have tried to manipulate the next/submit button process its seems to erase the answers on that page before moving on, I suspect I am not adding to the stock next/submit buttons functions but rather replacing the stock function with my own. I am using
$('#movenextbtn, #movesubmitbtn').bind('click', function () {
to try and manipulate what the next button does.
Sorry for all of the questions I do not have much experience with Java and Limesurvey. Thank you.
$('#movenextbtn, #movesubmitbtn').bind('click', function () {
to try and manipulate what the next button does.
Sorry for all of the questions I do not have much experience with Java and Limesurvey. Thank you.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 5 months ago #127896
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 Set Relevance Status using the Expression Manager?
Oh, wait, I wasn't reading the question correctly. Q1 should still be relevant if answered (it's still a valid answer), you just want to hide it. What type of question is Q1?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- AGK925
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 3
8 years 5 months ago - 8 years 5 months ago #127897
by AGK925
Replied by AGK925 on topic Set Relevance Status using the Expression Manager?
Q1 is a list(radio) question. I saw the thread below:
Topic: Hide Question if prefilled
and I was trying to manipulate that code to hide if the question once it was answered when the next button was clicked, but i am not experienced enough with Java, I have a lot to learn.
Thanks
Topic: Hide Question if prefilled
and I was trying to manipulate that code to hide if the question once it was answered when the next button was clicked, but i am not experienced enough with Java, I have a lot to learn.
Thanks
Last edit: 8 years 5 months ago by AGK925. Reason: edit url to reference correct post in thread
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 5 months ago - 8 years 5 months ago #127898
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 Set Relevance Status using the Expression Manager?
Try this in the question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { if($('#question{QID} input.radio:checked').length > 0) { $('#question{QID}).hide(); } }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 5 months ago by tpartner.
The following user(s) said Thank You: AGK925
The topic has been locked.
- AGK925
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 3
8 years 5 months ago - 8 years 5 months ago #127899
by AGK925
Replied by AGK925 on topic Set Relevance Status using the Expression Manager?
Thanks, I that worked great. I thought it might be something simple, but I am still learning.
As a note:
I changed
to
Just in case anyone finds this thread later.
As a note:
I changed
Code:
$('#question{QID}.hide();
Code:
$('#question{QID}').hide();
Just in case anyone finds this thread later.
Last edit: 8 years 5 months ago by AGK925.
The following user(s) said Thank You: levilarsen
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 5 months ago #127900
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 Set Relevance Status using the Expression Manager?
Oh, yeah, oops...
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.