1

We have a customer who would like to disable the ability for end users to type in values directly for a UserField control in a page layout. They would like the users to only use the adress book.

We have the similar functionality on another site but there we use the PeopleEditor control. That control have the attribute AllowTypeIn which gives us the ability to force the users to use the Adress book instead.

How would I achieve the same functionality for a UserField? Should I use a script or can I do some override of the UserField control?

/Niclas

1

You can use following code. you will need jQuery for that:

    $(document).ready(function () {
    $('table.ms-usereditor div.ms-inputuserfield').attr('contenteditable', 'false')
});

for deployment you can use CustomAction as described here

0

Declare your field in markup as this:

 <SharePoint:UserField ID="UfEmployee" runat="server" FieldName="Employee"/>

To Disable use this code in OnPrerender:

   var ppe = (PeopleEditor)UfEmployee.TemplateContainer.FindControl("UserField");
   ppe.Enabled = false;

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.