3

I'm trying to replace all of the "bad" old-style people pickers on our custom new/edit forms with the new good client-people pickers.

With this thread I came up with the idea to use jquery to find all the bad people pickers on the form, hide them, create good people pickers in the same spot, and copy the info over from the hidden bad people pickers. Then on save use PreSaveAction() to copy any changes from the good people pickers back into the hidden bad ones. This is working well

But I realized there are several configuration things like, "allow multiple entries" or "limit choices to this group" and I wasn't sure how to properly configure the new good people picker to match the existing site column.

In this thread helped me figure out how to retrieve all the information about people columns in the list. I'm using this REST call.

https://<sitename>/_api/web/lists/getbytitle('listname')/Fields?$filter=Hidden eq false and ReadOnlyField eq false and TypeDisplayName eq 'Person or Group'

And I can find the appropriate values for each people column, but now I can't figure out how to identify which bad people picker goes with which site column. Clearly behind the scenes SP has some way to know which bad people picker is writing to which column, but I can't figure out how it works.

For example I have two bad-pickers one for AssignedTo and the other AssigneTo. There doesn't appear to be anything in the DOM that says which is which. So when I pull back the configuration information for the column using REST I only have a 50-50 chance of getting it right.

So how can I match up the details with the correct people picker?

This whole thing seems really round about way to get a custom New/Edit form, so if there is a better way to do this I would appreciate any input. But it would also be nice to know how to match up any given input on a form with the column it belongs to.

0

This sounds like a pretty good idea, and although I haven't done this before, the best way to go ahead with this would be to use JS Link to override your user fields (AssignedTo and AssigneTo) in New and Edit forms.

If you aren't already familiar with JS Link, let me give you a headstart. It is basically a script that sits between your UI and SharePoint OOB rendering. This allows you to override the default behavior of a field and push something different on the UI instead.

You will find some really creative people on internet. One of the best places to start is here. You will be able to see a set of examples covering ways in which you could use this.

Also, I doubt if you would even need to use the REST API to get the field info, as you should be able to get that from context in the template overrides.

  • 1
    JS Link and CSR would be great, but I haven't had much luck with that. I don't find it well documented and most examples seem pretty simple -- change color or design, not replace entire control with another control. But I can give it go. First problem is that on a new/edit form there isn't a spot for JS Link. I understand that you don't actually have to use the JS Link of the webpart that contains the fields, but I'm still not clear on how to get started with that. – Rothrock Mar 28 '16 at 19:20
  • Yeah I've been trying to put some code on the page and nothing is happening. Also in the tutorials I see you need to know the names of the fields up front. I want to replace all of the people pickers. Is that possible with csr/jslink? – Rothrock Mar 28 '16 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.