- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Preventing a person from choosing his/her own name off the dropdown list
- merclimcg
- Topic Author
- Offline
- New Member
Less
More
10 years 4 months ago #101631
by merclimcg
Preventing a person from choosing his/her own name off the dropdown list was created by merclimcg
Noob alert.
I created a peer evaluation survey for my company. I have a dropdown list that contains all employees in the company. How can I prevent a person taking the survey from choosing his/her own name off the list and evaluating him/herself?
This is a close survey but not an anonymous one and I activated token tracking.
Any help will be much appreciated.
Thanks.
merclim
I created a peer evaluation survey for my company. I have a dropdown list that contains all employees in the company. How can I prevent a person taking the survey from choosing his/her own name off the list and evaluating him/herself?
This is a close survey but not an anonymous one and I activated token tracking.
Any help will be much appreciated.
Thanks.
merclim
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
10 years 4 months ago - 10 years 4 months ago #101642
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 Preventing a person from choosing his/her own name off the dropdown list
Assuming that drop-down option contains the token first-name and the token last-name, separated by a space, you can
set up your survey to use JavaScript
and add this to the question source. It will remove the option.
Code:
<script type="text/javascript" charset="utf-8"> var firstName = '{TOKEN:FIRSTNAME}'; var lastName = '{TOKEN:LASTNAME}'; $(document).ready(function() { $('#question{QID} option').filter(function() { return $(this).text() == firstName+' '+lastName; }).remove(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 4 months ago by tpartner.
The following user(s) said Thank You: merclimcg
The topic has been locked.
- merclimcg
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
10 years 4 months ago #101650
by merclimcg
Replied by merclimcg on topic Preventing a person from choosing his/her own name off the dropdown list
Holy molly! tpartner, it worked like a charm! Zillion thanks to you man!
The topic has been locked.