- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Survey permission
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
7 years 5 months ago #143963
by nohcho82
Survey permission was created by nohcho82
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 5 months ago #143968
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 Survey permission
1) Create your own admin template with a custom JavaScript file -
www.limesurvey.org/forum/can-i-do-this-w...in-admin-page#137765
2) Insert something like this into the custom JavaScript file. It will sort the list options by their strings split at the first space.
2) Insert something like this into the custom JavaScript file. It will sort the list options by their strings split at the first space.
Code:
$(document).ready(function(){ // Sort the user list in "Survey permissions" if($('#uidselect').length > 0) { var userList = $('#uidselect'); var userOptions = $('option', userList); var selectedOption = $(userList).val(); // Case insensitive sort // Options sorted by string split at the first space /* userOptions.sort(function(a,b) { if (a.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1").toLowerCase() > b.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1").toLowerCase()) return 1; if (a.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1").toLowerCase() < b.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1").toLowerCase()) return -1; return 0 }); */ // Case sensitive sort // Options sorted by string split at the first space userOptions.sort(function(a,b) { if (a.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1") > b.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1")) return 1; if (a.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1") < b.text.replace(/^([^\s]+)\s(.+)$/,"$2 $1")) return -1; return 0 }); $(userList).empty().append(userOptions); $(userList).prepend($('option[value="-1"]', userList)); $(userList).val(selectedOption); } });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 5 months ago - 7 years 5 months ago #143976
by nohcho82
Replied by nohcho82 on topic Survey permission
I did it step by spep but still the same:(
I juist copy/paste this code to my new JS file. Did I something wrong?
I juist copy/paste this code to my new JS file. Did I something wrong?
Last edit: 7 years 5 months ago by nohcho82.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 5 months ago #144003
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 Survey permission
That script is for version 2.06 LTS. What is your 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.
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 5 months ago #144006
by nohcho82
Replied by nohcho82 on topic Survey permission
2.05+ build 141020
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 5 months ago #144015
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 Survey permission
Hmm...it works for me in 2.05.
Do you have any JavaScript errors in the console. Can you get a simple JavaScript alert to work?
Do you have any JavaScript errors in the console. Can you get a simple JavaScript alert to work?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 5 months ago #144019
by nohcho82
Replied by nohcho82 on topic Survey permission
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 5 months ago #144020
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 Survey permission
I ask again. Do you have any JavaScript errors in the console. Can you get a simple JavaScript alert to work?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 5 months ago #144021
by nohcho82
Replied by nohcho82 on topic Survey permission
No, I get no errors in the console. I created a simple JavaScript alert, its works.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 5 months ago #144023
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 Survey permission
I'm sorry then, I can't explain why it works for me but not for you.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- nohcho82
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 5 months ago #144025
by nohcho82
Replied by nohcho82 on topic Survey permission
Default is sort by user_name. It is not possible just change the default code to sort by full_name? Where can I find the file with default code?
The topic has been locked.