spjs.ac.peoplePicker

Forums Autocomplete spjs.ac.peoplePicker

This topic contains 17 replies, has 2 voices, and was last updated by  Alexander Bautz 1 month, 3 weeks ago.

  • Author
    Posts
  • #26007

    Kasey
    Participant

    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?

  • #26017

    Alexander Bautz
    Keymaster

    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

  • #26025

    Kasey
    Participant

    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.

  • #26037

    Alexander Bautz
    Keymaster

    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

  • #26041

    Kasey
    Participant

    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!

  • #26055

    Alexander Bautz
    Keymaster

    I’ll look into it when I return from an little vacation in the beginning of next week.

    Alexander

  • #26120

    Alexander Bautz
    Keymaster

    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

  • #26122

    Kasey
    Participant

    1.6.28

  • #26131

    Alexander Bautz
    Keymaster

    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

  • #26149

    Kasey
    Participant

    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”:[]
    });

  • #26157

    Alexander Bautz
    Keymaster

    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

  • #26160

    Kasey
    Participant

    PERFECT! Thank you!!

  • #26201

    Kasey
    Participant

    I spoke too soon. It renders on the form as expected but the selected value is not saved in the People Picker.

  • #26203

    Kasey
    Participant

    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);
    }

  • #26205

    Kasey
    Participant

    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.

  • #26213

    Alexander Bautz
    Keymaster

    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

  • #26218

    Kasey
    Participant

    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!

  • #26239

    Alexander Bautz
    Keymaster

    Thank you for the feedback – I’m glad we got this sorted out.

    Alexander

You must be logged in to reply to this topic.