Home › Forums › Autocomplete › spjs.ac.peoplePicker
- This topic has 17 replies, 2 voices, and was last updated 5 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
July 10, 2019 at 17:53 #26007
I have a need for a user to select someone from a group. The out of the box people picker configured this way requires the user to input a portion of the name before any results are returned to select. I thought I could use spjs.ac.peoplePicker with the listOpsionsOnFocus set to true to show all users in the group on focus. Is there a way to make that happen?
-
July 11, 2019 at 08:16 #26017
I guess this should work – have you tested it? – here is a link to the configuration example: https://spjsblog.com/dffs/dffs-plugins/spjs-autocomplete/#Autocomplete_in_a_people_picker
Please note that if you use SP 2013 you must set forceOn2013 to true.
Alexander
-
July 11, 2019 at 13:53 #26025
It works but you must know a portion of the target user’s name or email address. Setting listOptionsOnFocus to true doesn’t change the behavior. My hope was that if that was set to true when you click into the control it would show the first [rowlimit] number of users in the group to select from.
-
July 11, 2019 at 23:14 #26037
That would be the expected behavior, but maybe I have a bug related to the listOptionsOnFocus setting. To be honest I have not focused on the people picker implementation since SP 2010 now that SP 2013+ have autocomplete on the pp already.
Just a little checkup: You have written the setting like this: listOpsionsOnFocus, but the correct format is this: listOptionsOnFocus. I guess it’s just a typo here, but if not you can try correcting it in the function call.
I’ll look at it and see if I can get it in the next DFFS release – hopefully during next week.
Alexander
-
July 12, 2019 at 00:06 #26041
It was just a typo in the blog post. I copied the function from the documentation and changed false to true. When I click into the control nothing happens until I start typing. I appreciate you looking into it!
-
July 13, 2019 at 17:05 #26055
I’ll look into it when I return from an little vacation in the beginning of next week.
Alexander
-
July 18, 2019 at 12:26 #26120
I tested now with the latest version and it does list the users when I focus the field – which version of spjs-ac are you running?
Alexander
-
July 18, 2019 at 13:41 #26122
1.6.28
-
July 19, 2019 at 08:52 #26131
I have made some changes since that version (not published), but cannot remember to have fixed this issue. You can try the attached version to see if it’s actually fixed.
Alexander
Attachments:
-
July 20, 2019 at 01:19 #26149
I tried with the new version with the same results. Below is the code I am using for reference. Maybe I have one thing out of line that is causing the behavior?
Person is a Person or Group type field; allow multiple selections = no; allow selection of = people only; Choose from = Person Group; enforce unique values = no
spjs.ac.peoplePicker({
“applyTo”:”Person”,
“forceOn2013”:true,
“helpText”:””,
“showField”:”Title”,
“enforceUniqueValues”:false,
“chooseFromUserGroup”:”Person Group”,
“showUsersOnly”:true,
“rowLimit”:20,
“listOptionsOnFocus”:true,
“reValidateOnLoad”:true,
“setFields”:[]
}); -
July 20, 2019 at 17:30 #26157
Try the attached version – ensure it shows as v1.6.34 when you load the form (by clicking the Enhanced with DFFS link and clicking the License and version information link).
Alexander
Attachments:
-
July 20, 2019 at 17:36 #26160
PERFECT! Thank you!!
-
July 22, 2019 at 21:38 #26201
I spoke too soon. It renders on the form as expected but the selected value is not saved in the People Picker.
-
July 22, 2019 at 23:43 #26203
As a temporary fix I am executing a function on form save to set the value.
function resolveAC(){
var p1 = getFieldValue(“PeoplePicker”);
setFieldValue(“PeoplePicker”,p1);
} -
July 23, 2019 at 01:06 #26205
This above works most of the time but I still have an issue with some users. What I need to be able to do, if possible, is upon selecting a user from the list is set the field value to the Name or EMail of the selected instead of the title. When I debugged I could see that data in the results array but couldn’t figure out how to use it to set the field value. People with apostrophes in their name cause issues with my current workaround.
-
July 23, 2019 at 10:39 #26213
I’m sorry about that – I have checked and it didn’t save properly in my setup either. I have made some changes and It work at my end now – can you test the attached version?
PS: I think it should work with apostrophes now – let me know if it doesn’t. It might however be a problem with user display names that are not unique. If you have issues with that I think you might have to use a placeholder / dummy single line of text to apply the autocomplete to and use the setFields section to set the actual people picker.
Alexander
Attachments:
-
July 23, 2019 at 13:35 #26218
Yes, it is working now with apostrophes. I don’t think I’ll have an issue with duplicate display names so I think I’m good to go now. Thank you!
-
July 24, 2019 at 10:08 #26239
Thank you for the feedback – I’m glad we got this sorted out.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.