- Posts: 153
- Thank you received: 8
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
data cleaning of answers in not relevant questions
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
5 years 3 months ago #179673
by KompetenzZ
Cheers kompetenzz
data cleaning of answers in not relevant questions was created by KompetenzZ
Hi community,
is there an option (I guess with javascript) to remove the inputs (the answers given by respondents) from a multiple choice and multiple numerical input question when the question gets "hidden" because the question is currently not relevant (concerning relevance equation). So to say data cleaning.
In other words, when a question was answered, but then the relevance equation changes to wrong (not relevant), the question becomes hidden, and then the answer input of respondents in the question should be removed (cleaned).
LS Version 3.14
is there an option (I guess with javascript) to remove the inputs (the answers given by respondents) from a multiple choice and multiple numerical input question when the question gets "hidden" because the question is currently not relevant (concerning relevance equation). So to say data cleaning.
In other words, when a question was answered, but then the relevance equation changes to wrong (not relevant), the question becomes hidden, and then the answer input of respondents in the question should be removed (cleaned).
LS Version 3.14
Cheers kompetenzz
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
5 years 2 months ago #179686
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 data cleaning of answers in not relevant questions
There is no JavaScript method to detect when an element is hidden or to detect class changes so you would need to put listeners on the questions that are triggering the relevance change. These listeners (and the resulting callbacks) would vary depending on the question types and IDs.
Having said that, I don't see what the problem is. The answers in irrelevant questions only persist until the survey page (group) is submitted.
Having said that, I don't see what the problem is. The answers in irrelevant questions only persist until the survey page (group) is submitted.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 2 months ago - 5 years 2 months ago #179690
by DenisChenu
Currently :
Relevance updated (set to on/off) : github.com/LimeSurvey/LimeSurvey/blob/2f...survey/survey.js#L24
Class change due to error : github.com/LimeSurvey/LimeSurvey/blob/ma...urvey/survey.js#L342
Else :
Why do you want to clean previous value ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic data cleaning of answers in not relevant questions
Sorry Tony,tpartner wrote: There is no JavaScript method to detect when an element is hidden or to detect class changes so you would need to put listeners on the questions that are triggering the relevance change.
Currently :
Relevance updated (set to on/off) : github.com/LimeSurvey/LimeSurvey/blob/2f...survey/survey.js#L24
Class change due to error : github.com/LimeSurvey/LimeSurvey/blob/ma...urvey/survey.js#L342
Else :
It's the case (by default) when move next only, then if user check a input:checkbox by error , it don't loose previous answer.In other words, when a question was answered, but then the relevance equation changes to wrong (not relevant), the question becomes hidden, and then the answer input of respondents in the question should be removed (cleaned).
Why do you want to clean previous value ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 2 months ago by DenisChenu.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
5 years 2 months ago #179692
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 data cleaning of answers in not relevant questions
@DenisChenu, no need to apologize. Do you have a solution?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 2 months ago #179695
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic data cleaning of answers in not relevant questions
Hi,
sorry, I didn't know that the previous values are cleaned anyway by clicking next. In that case everything is fine. I just thought that I need to remove the answers of hidden questions afterwards in the data analysis in spss. Thank you.
sorry, I didn't know that the previous values are cleaned anyway by clicking next. In that case everything is fine. I just thought that I need to remove the answers of hidden questions afterwards in the data analysis in spss. Thank you.
Cheers kompetenzz
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 2 months ago #179722
by DenisChenu
But else : usage of on(!relevance:off' can do the trics
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic data cleaning of answers in not relevant questions
I think we don't need solution, since LS behaviour cleanup value when move next.tpartner wrote: @DenisChenu, no need to apologize. Do you have a solution?
But else : usage of on(!relevance:off' can do the trics
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 2 months ago #179971
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic data cleaning of answers in not relevant questions
Hi,
can you please tell me where to insert this '!relevance:off'. I would need the solution yet because I have this question multiple numeric question where the answer option 'thereof irrigated' is showed when 'cropland' is > 0. But when respondents type something in 'thereof irrigated' and then change back 'cropland' to 0 they cannot proceed further because 'thereof irrigated' cannot be greater than 'cropland' (I did it with max value of the <input type="number"> field). In that case the answer option 'thereof irrigated' is hidden (if it is shown, it would have a red background) and the respondent doesn't know why he cannot proceed.
'thereof irrigated' cannot be greater than 'cropland':
when 'cropland' is 0 and 'thereof irrigated' has a value inside, respondents cannot proceed:
can you please tell me where to insert this '!relevance:off'. I would need the solution yet because I have this question multiple numeric question where the answer option 'thereof irrigated' is showed when 'cropland' is > 0. But when respondents type something in 'thereof irrigated' and then change back 'cropland' to 0 they cannot proceed further because 'thereof irrigated' cannot be greater than 'cropland' (I did it with max value of the <input type="number"> field). In that case the answer option 'thereof irrigated' is hidden (if it is shown, it would have a red background) and the respondent doesn't know why he cannot proceed.
'thereof irrigated' cannot be greater than 'cropland':
when 'cropland' is 0 and 'thereof irrigated' has a value inside, respondents cannot proceed:
Cheers kompetenzz
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 2 months ago - 5 years 2 months ago #179973
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic data cleaning of answers in not relevant questions
Can you send a lss with just this question ?
I think it must work out of the box, but maybe validation of question must be fixed .
demo.sondages.me/582387
I think it must work out of the box, but maybe validation of question must be fixed .
demo.sondages.me/582387
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 2 months ago by DenisChenu.
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 2 months ago #179991
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic data cleaning of answers in not relevant questions
It's your script to fix :
Code:
var grass = $( '#question{QID} input.form-control.em_sq_validation:eq(2)').val(); if(grass > 0) { $( '#question{QID} input.form-control.em_sq_validation:eq(3)').attr({ "max" : grass }); }else { $( '#question{QID} input.form-control.em_sq_validation:eq(3)').removeAttr('max'); }
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 2 months ago #179992
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic data cleaning of answers in not relevant questions
Sure, never thought about a simple else statement
I'm sorry that I did not have this idea before.
I'm sorry that I did not have this idea before.
Cheers kompetenzz
The topic has been locked.