Get value from people picker

1.6k Views Asked by At

How how can I get the value from a people picker control?

 if (colListItem.get_item(User).length > 1) {
                for (var i = 0; i < colListItem.get_item(User).length; i++)
  {
  //Append all User names with a semi colon separator

               _User = _User + colListItem.get_item(User)[i].get_lookupValue() + ";";
                }
                        _User.trim;
                }
                }
            }

This works if there is more than one value in the people picker control. But if there is only one value, I am unable to retrieve it.

1

There are 1 best solutions below

2
On

Change it from:

if (colListItem.get_item(User).length > 1)

To:

if (colListItem.get_item(User).length >= 1)

If there is only one value, only the second one will be true.