How to make a people picker field editable using Javascript

Hi All,
I wrote an javascript which populates current loggedin user name on to an people picker, which is working fine,
   But its making the people picker field as readonly, i want this field to be editable so that i can add more users with the current loggedin user name already populated in the newform.aspx
below is the script what i have written
<script src="/_catalogs/masterpage/MashreqMasterpage/scripts/jquery-1.5.1.min"></script><script type="text/javascript" src="/_catalogs/masterpage/MashreqMasterpage/scripts/jquery.SPServices-0.7.1a.min.js"></script><script
type="text/javascript">
 $(document).ready(function() {
     var user= $().SPServices.SPGetCurrentUser({fieldName: "Title"});
      $("div[title='Name']").text(user);
</script>
please help, thanks in advance

Hi,
Please modify your code a bit as below, it won’t make the people picker control read only after setting a value:
var controlName = "MyPersonField";
// Select the People Picker DIV
var ppDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
// find the <input> under pp DIV
var ppEditor = ppDiv.find("[title='" + controlName + "']");
// Get the instance of the People Picker from the Dictionary
var spPP = SPClientPeoplePicker.SPClientPeoplePickerDict[ppDiv[0].id];
ppEditor.val(user);
spPP.AddUnresolvedUserFromEditor(true);
Best regards
Patrick Liang
TechNet Community Support

Similar Messages

  • How to make the 'Finish Date' field Editable in Project server 2013

    Hi All,
    In Project server 2013 on premises deployment, When I try to create a new enterprise project [Also in case of new custom project type], Only the 'Start Date' field is available. The 'Finish Date' field is by default taking the value of the 'start Date' itself.
    I am unable to make this 'Finish Date' field editable.
    Any pointers on this would be very helpful,
    Thanks
    Shanky

    Shanky --
    When you create a new project in either Microsoft Project Professional or Project Online, the system does not allow you to enter both a Start date and a Finish date for the project.  Here is how the software works:
    You enter the Start date of the project.
    You completely plan the project with tasks, task dependencies, task Durations, and assigning resources to tasks.
    Based on the Start date you provide, plus all of the task information, the software calculates the Finish date of the project for you.  So, you cannot provide both the Start date and the Finish date, nor is they any way to force the system to allow
    you to do this.  Hope this helps.
    Dale A. Howard [MVP]

  • How to Make a Table control Field Editable but input disabled

    Hi All,
        I got a requirement that in table control one column should be in edit mode (i.e. input enabled) but user should not be able to type anything in that field or column rather he can select the value from F4 help (or pick list) associated with that field or column. How to do this ? Please dont say make sceeen-input = 0 for that field.
    Experts please help me out...........
    Thankx in Advance
    Rizwan Ahmad Siddiqui

    Hi,
    I suggest you to go for a drop down instead of a search help.
    Regards,
    Charumathi.B

  • SharePoint 2013 July 2014 CU - People Picker fields empty in Edit forms

    After applying the July 2014 CU for SharePoint server, I discovered that Person or Group (People Picker) fields are not populated with server values in list item Edit forms.  However, the field values can be viewed in list views
    and in Display forms.  I examined the client side code and determined that field data is not being returned from the server for Edit forms. 
    In a test environment, I uninstalled SharePoint 2013, reinstalled SP 2013 with SP1 and the issue went away.  I then applied the May 2014, June 2014, and July 2014 CUs.  The issue did not exist after applying the May and June CUs.  It
    did exist after applying the July 2014 CU.

    There is a workaround for this issue.  It's a little convoluted, but hey, it's SharePoint.  First, you must have a list that has at least one entry in it.
     To begin with, you must first
    have a list with at least one item in the list.
    Next you edit the item with a role that has at least Design privilege, but don't save your changes.
    Instead you Edit the page so you can then edit that web part.  You can edit the page by clicking on the cog icon and selecting Edit Page
    Edit the web part itself
    Under “Miscellaneous” section on the just exposed web part window, select "Server Render (Server Render)" in the drop down labeled “CSR Render Mode
    Click on “Apply” button within the web part
    Save
    I was told also the Sept CU would fix the issue but it is under review and to wait until the first of October.  Incidentally we found that if you put the entire list into Quick Edit mode, the issue does
    not appear.
    I hope this helps someone.

  • How to make Buyer and Planner fields in Master Items Form Required without

    How to make Buyer and Planner fields in Master Items Form Required without using personalization?
    1) Steps to Reproduce
    Under Application Developer Common Modules responsibility,
    1) Query Region MTL_SYSTEM_ITEMS
    2) Click on Region Items
    3) Add Buyer Id and Planner Code attributes with Required checkbox checked.
    4) Bounce iAS server and JVM and clear java cache
    5) Changes not taking effect
    Current Application Release: 11.5.10.2 (3460000)
    Current INV Rollup: INV.J RUP22 (9878808)
    Current WMS Rollup: WMS RUP19 (9951502)
    Product Installation List :
    Product Installation: 11i.BOM.J: Installed
    Product Installation: 11i.EGO.E: Installed
    Product Installation: 11i.ENG.I: Installed
    Product Installation: 11i.INV.J: Installed
    Product Installation: 11i.PO.I: Installed
    Product Installation: 11i.WMS.G: Installed
    client needs to make the Buyer and Planner fields under Inventory->master Items form to be required.
    He tried using the Application Developer Common Modules responsibility, to find the Master Items Region and added the Buyer Id and Planner Code attributes with the Required check-box set to Yes. He bounced the iAS server and cleared java cache, but the changes do not take effect.
    client does not want to use form personalization.
    Can you please provide more assistance for using Application Developer Common Modules responsibility?
    Edited by: jemar98 on Aug 9, 2011 1:44 PM

    A forms developer could make those fields required with a CUSTOM.pll extension if you didn't want to use forms personalization. Both are considered customizations to standard functionality and may or may not require rework after patching or upgrades.

  • People Picker field and Web service -- multiple round trips to get Display Name value

    Using Sharepoint 2010 and Infopath 2010, I have created a form that validates fields entered within the form by connecting to a .Net web service created  by someone else.  One of the fields that I need to validate is a People Picker field
    for the Project Manager. 
    The connection to the Web Service runs correctly except that the People Picker goes through the validation process 3-4 times.   I know this because I have a MessageBox showing the value for the InnerXML that pops up 3 times.  The
    first time the MessageBox shows no value for the XML, the next time it shows a name, and the 3rd time it shows no value.
    Here is the code I'm using in the Infopath form (without the Messagebox):
    Dim wsConnection As WebServiceConnection = DirectCast(Me.DataConnections("Validate"), WebServiceConnection)
    Dim formNavigatorProjectManager As XPathNavigator = MainDataSource.CreateNavigator()
    Dim wsNavigatorProjectManager As XPathNavigator = Me.DataSources("Validate").CreateNavigator()
    strformNavProjectManager = formNavigatorProjectManager.SelectSingleNode("/pr:properties/p:properties/documentManagement/ns3:ProjectManager/ns3:UserInfo/ns3:DisplayName", NamespaceManager).InnerXml
    wsNavigatorProjectManager.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns7:Validate/ns7:projectManager", NamespaceManager).SetValue(strformNavProjectManager)
    wsConnection.Execute()
    The line in BOLD above used to have just /pr:properties/p:properties/documentManagement/ns3:ProjectManager
    but I thought my problem might be because People Picker fields are made up of 3 elements -- DisplayName, AccountID and Account Type. So I changed the XML.  Sadly, that didn't make any difference.
    I am using the CHANGED event which a colleague of mine thought would have taken care of the multiple round trips.  But it didn't.
    Hopefully someone out there can tell me what I need to do so that this People Picker field only get validated once (The form also has Managed Metadata fields that have very similar problems so I'm hoping that the solution for the People Picker field
    takes care of the MMD fields too.)  Thanks in advance.  Carol.

    Hi Carol,
    It is the behavior for setting People/Group field if you just select the node "/dfs:myFields/dfs:queryFields/ns7:Validate/ns7:projectManager".
    Also you can try to only set the AccountID value of the People/Group field:
    Dim wsConnection As WebServiceConnection = DirectCast(Me.DataConnections("Validate"), WebServiceConnection)
    Dim formNavigatorProjectManager As XPathNavigator = MainDataSource.CreateNavigator()
    Dim wsNavigatorProjectManager As XPathNavigator = Me.DataSources("Validate").CreateNavigator()
    strformNavProjectManagerID = formNavigatorProjectManager.SelectSingleNode("/pr:properties/p:properties/documentManagement/ns3:ProjectManager/ns3:UserInfo/ns3:AccountID", NamespaceManager).InnerXml
    wsNavigatorProjectManager.SelectSingleNode("/dfs:myFields/dfs:queryFields/ns7:Validate/ns7:projectManager/ns7:userinfo/ns7:AccountID", NamespaceManager).SetValue(strformNavProjectManagerID)
    wsConnection.Execute()
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers
    if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
    Eric Tao
    TechNet Community Support

  • How to make other people image more beautiful

    how to make other people image more beautiful?

    Well I think this is a good topic that has a lot of possibilities, I understand the OP is seemingly being vague but I think perhaps it might be grammatical more then lack of content.
    <br />
    <br />But there are techniques and different approaches to capturing the best qualities of the subject especially those of the human subject.
    <br />
    <br />cjmah
    <br />
    <br />the best way to go about this is post an image that you took of someone that you think can be improved and we can share with you techniques and ideas about equipment that you might like to have to help you achieve what you want to achieve.
    <br />
    <br />Her you save the image as a jpeg about 600 to 700 pixels on the longest length the go to this link
    <br />
    <br />http://www.pixentral.com you follow the instructions for uploading the file then you copy the text in the top text field and paste it into you message before you post it.
    <br />
    <br />Make certain you copy all the text including the link you know from and including this
    <a all="" the="" way="" to="" and="" including="" this="" /></a>
    <br />
    <br />It is a good subject.

  • "People Picker" field not letting update SP linked table in Access

    Hello all,
    I have linked a SharePoint list to an Access database in order to manipulate some data. This list contains several fields, including a people picker in which its data come from SharePoint. 
    Once in my Access DB, I need to update some fields of this list, however when I try to change some values from a record that has the people picker populated I get the following error message: "you cannot reference rows created
    when you are disconnected from the server because this violates the lookup settings defined for this table". I only get this when I have values on people picker, I can proceed without any problem when I have it set as blank.
    So, do you have any idea on how to accomplish an update operation while having a people picker field populated?
    Thank you in advance.

    Hi Pedro,
    I recommend to check if the user populated in the RequestBy exits in User Information List in SharePoint site and the choices listed in Access for status field are existed in SharePoint Status column.
    Please refer to this thread for more details:
    https://social.technet.microsoft.com/Forums/office/en-US/8a7baf3b-5a3a-4631-82f9-b43d992155d1/updating-sharepoint-2010-list-from-access-2007?forum=sharepointgenerallegacy
    More reference:
    http://blog.incworx.com/blog/elizabeth-pecoras-sharepoint-blog/you-cannot-update-this-field-because-the-value-youre-trying-to-apply-is-not-valid-or-would-break-a-data-integrity-rule-error
    Best regards.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Is there a way to exclude temporary people picker fields from a query when receiving the "List View Lookup Threshold" error.

    Hi All,
    My users require the ability to select a sharepoint group from a drop down list and then be able to select a user from a people picker based on the drop down selection.    The best solution I was able to up with, was create a people picker
    for each drop down selection and set the Sharepoint group field to the selected group.  All people picker filed are hidden except the one that matches the drop down selection.  When creating an entry from the sharepoint list this method
    works perfectly.
    However, when I add the list onto a site page using an "Listview webpart", then add an infopath web part and then finally connect the two parts, I get a "List View Lookup Threshold" error when selecting an entry from the list.  I
    understand from the error and reading that this error is related to the number of People pickers in the list.   Is there a way to exclude temporary people picker fields from a site page query, as they are only temporary fields to allow the users
    to select a person and then assign the name to another field.
    Dwayne

    Hi Dwayne,
    In SharePoint 2013, we could manually create a list for all users. Here are the reference:
    Go to Site Settings >  People and Groups > SiteMembers
    Modify url
    http://sitename/_layouts/15/people.aspx?MembershipGroupId=8 to
    http://sp/sites/tutu/_layouts/15/people.aspx?MembershipGroupId=0 , now you will see All people in this site.
    Change the view to List view, and copy the listview id in the url
    http://sitename/_layouts/15/people.aspx?MembershipGroupId=0&View={viewID}
    Go to Settings > List settings, copy the list id in the url
    http://sitename/_layouts/15/listedit.aspx?List=listeid&Source=....
    Now type the address in IE:
    http://sitename/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=[LISTID]&View=[VIEWID]&CacheControl , such as
    http://sp/sites/tutu/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=f3958d27-9c2f-4f8d-b221-89466e816667&View=696BFDC5-0C6E-4E27-818F-0E6292A18407&CacheControl=1
    Save the owssvr.jqy from SharePoint site
    Now you could see the file in your desktop with all users, save it as allusers in Excel.
    Then import it to your SharePoint site, add an app > find an app > import spreadsheet
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Auto update people picker value with email id when we add username in another people picker field in sharepoint 2013 list using javascript

    hi friends
    i have to people picker fields
    pp1 and pp2
    pp1 represents username
    pp2 represents email id
    here i problem is if user enters name in pp1, pp2 has to update with email id of corresponding user in pp1 dynamically.
    using java script is there any solution for this.
    please help me

    Hope below will help
    <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script type="text/ecmascript" language="ecmascript">
    var user;
    var visitorsGroup;
    function runCode() {
    var clientContext = new SP.ClientContext();
    var groupCollection = clientContext.get_web().get_siteGroups();
    // Get the visitors group, assuming its ID is 4.
    visitorsGroup = groupCollection.getById(4);
    user = clientContext.get_web().get_currentUser();
    var userCollection = visitorsGroup.get_users();
    userCollection.addUser(user);
    clientContext.load(user);
    clientContext.load(visitorsGroup);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded() {
    alert(user.get_title() + " added to group " + visitorsGroup.get_title());
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />
    </asp:Content>http://msdn.microsoft.com/en-us/library/office/jj246835%28v=office.15%29.aspxhttp://msdn.microsoft.com/en-us/library/office/jj920104%28v=office.15%29.aspxhttp://stackoverflow.com/questions/20981226/sharepoint-2013-get-current-user-javascripthttp://sharepoint.stackexchange.com/questions/31457/get-user-via-javascript-client-object-model

  • How to make a list item field with DATE data type?

    I have a column with DATE data type. Using forms 6i I want to generate a poplist list item field with this column while the value of the elements in the list to will be day names like SATURDAY,SUNDAY,MONDAY. if we change the data type from date to char, it will work properly but now with DATE data type behind it, it gives the following error message
    "FRM-32082: Invalid value for given item type.
    List WEEKREST
    Item: WEEKREST
    Block: EMPRESTS
    Form: MODULE3
    FRM-30085: Unable to adjust form for output."
    Using forms 6i how to make a list item field with DATE data type which can hold day names?

    Set your date column as a hidden (non-displayed) field. Create your list item with the varchar2 day names. Create the list item as a non-base-table field that accepts the text values of day names. On that field, create a when-validate-item trigger that translates the text into a real date, which it then uses to set the value of the actual base-table item.

  • How to make the Profit Center Field Mandatory in Cost center Master Data

    Dear All,
    Please let me know how to make the Profit Center Field mandatory in Cost Center Master Data as well as my Internal Order Master Data?
    Thanks in advance!
    Regards,
    Rajeswari Shankar.

    Hi Rajeswari,
    You can modify message number KS096 to "Error" via OBA5. Thus, the users would no be able to save a cost center without entering a profit center. (Depending on your release you can make KS096 modifiable by implementing note 486781.) 
    Concerning the internal orders (transaction KO01), you can run KOT2 and set Profit center field as required entry in "change field selection" section.
    Regards,
    Greta

  • How to validate an text field item using javascript for numbers only.

    hi,
    how to validate an text field item using javascript for numbers only.please help me on this urgent
    please mail me solun if posible on [email protected]

    Hi,
    Page HTML header
    <script>
    function onlyNum(evt) {
      // Usage: onKeyPress="return onlyNum(event)"
      evt = (evt) ? evt : window.event;
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        var status = 'This field accepts numbers only!';
        alert(status);
        return false;
      var status = '';
      return true;
    </script>Item HTML Form Element Attributes
    onKeyPress="return onlyNum(event)"Br,Jari

  • How to make a program for backgroung processing used servlet

    how to make a program for backgroung processing used servlet

    well i need the coding part written in servlet ,in which servlet is always ready for accepting a client request.

  • How can i read XML from local drive using Javascript into Live Cycle

    Hello,
    I am creating PDF Form using Acrobat LiveCycle.
    I want to write java script for load data into relative field and data present into xml file which is located at local drive
    I have write all method for parsing xml which is required ............... but i am stuck into how to read/open/load local drive xml using javascript?

    sandyrock:
    You'd better post this message to Adobe LiveCycle forum: http://www.adobeforums.com/webx/.3bbeda8d/
    You can use postMessage method in LiveCycle JavaScript to communicate with host application,the host application can be a web brower like IE.
    In IE you can use IE javascript to access local XML file.

Maybe you are looking for

  • How to stop auto comnnecting to share as AppleID (permissions)

    OK chaps and chapesses, I've had a search but the question I want to ask usually gets asked in reverse (how to connect as Apple ID). This is the scenario. 1) I have 2 macs - a 2009 Mac Pro desktop and a 2011 MacBook Pro. 2) They are (at the moment) e

  • Cannot connect my C7280 wirelessly to my Netgear WNDR3400V3

    Greetings, Trying to connect my wireless Netgear WNDR3400V3 routher to my HP C7280.  I enter the SSID and password, using WPA and get error:  can not conect to network. What am I missing. Thanks, AJ

  • Inputting string like in C

    I'm new in Java. I used to be C programmer. I cannot find such method which can handle some input like scanf( ) in C. Is there any? If any, please some one tell me. I'm trying to build an interactive console application with Java, I know it is possib

  • Help with AT NEW

    Hallow I wont to do this code with <b>AT</b> but when I add the at line I get subrc-4 (in select) and when I remove the at new statment the code is working well . I see in the debugger that field <b>bdate</b> is =****** why and how I solve this probl

  • Modify a color into Pantone with JS

    Hi. I'm working on a application in Javascript. My claim is to manage the colors in my document. So, for example, I have to change some specific colors in "spot" or "process" model. if (value==1){ app.activeDocument.colors.item(7).model=ColorModel.sp