Possible Bug in getFieldValue on Display Form for MultiUserField

Forums SPJS-Utility Possible Bug in getFieldValue on Display Form for MultiUserField

Viewing 3 reply threads
  • Author
    Posts
    • #21955

      Hi Alexander,

      I’ve encountered a strange behaviour in getFieldValue for a MultiUserField in the Display Form for an Item:

      If I execute getFieldValue (does not matter if only with Field name or with delimiters and “True” for dispform) it get the User Names concatenated to each other without any delimiter in one single string block. However for edit and new form it works without any problem.

      Is there something I’m doing wrong or is there some strange behaviour in the disp form ?

      Thank you very much in advance.

      BR,
      Chris

    • #21958
      Alexander Bautz
      Keymaster

      Hi,
      You are correct – the code used in getFieldValue for multichoice people pickers doesn’t work correctly. I think maybe SP has changed how the values are displayed in DispForm.

      I’ll fix it in the next release, but in the meantime you can use this format instead of getFieldValue:

      spjs.dffs.beforeProperties.YourPeoplePickerFieldInternalName

      Alexander

      • #21962

        Hi Alexander,

        Thank you for the feedback. Unfortunately your suggested format returns an empty array, but the field has 2 persons inside actually (see attached Screenshot)

        Do you have any other suggestion for me ?

        Thank you very much and BR,
        Chris

        Attachments:
    • #21972
      Alexander Bautz
      Keymaster

      You can put this function in your custom js:

      function getPeoplePickerInDispForm(fin){
      	var b = [];
          jQuery("#dffs_"+fin+" td.ms-formbody a").each(function(i,a){
              if(jQuery(a).attr("onclick").match("GoToLinkOrDialogNewWindow") !== null){
                  b.push(a.innerText);
              }
          });
      	return b;
      }

      Then use this to get the value:

      var pp = getPeoplePickerInDispForm("FieldInternalName");

      Let me know how this works.

      Alexander

      • #21982

        Hi Alexander,

        Thank you very much, your last solution works like a charm 🙂

        BR,
        Chris

    • #21994
      Alexander Bautz
      Keymaster

      Thanks for the feedback, I’ll include this change in the next version of SPJS-Utility.js.

      Best regards,
      Alexander

Viewing 3 reply threads
  • You must be logged in to reply to this topic.