Programmatically change user field when readonly

Forums Dynamic Forms for SharePoint Programmatically change user field when readonly

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 1 month ago.

  • Author
    Posts
  • #19425

    Andreas Blüher
    Participant

    Hello Alexander,

    first of all I wanted to say that I really like the new dev config feature!

    We’re trying to remove all users from a spuserfield under certain circumstances. We found the following link descriping how to do so

    https://sharepoint.stackexchange.com/questions/119008/in-2013-using-javascript-how-do-you-empty-a-people-picker-field

    The field we’re trying to alter is been set readonly by dffs. Under the wood the values are sucessfully removed, but the form still shows the values as if they were there. When you save and close the form, noone is in the userfield anymore. So this seems to be a display issue.

    Do you have an idea how we could clear a readonly spuserfield or if there’s something we can do after running the code from the link to remove the text in the form.

    Kind regards,
    Andreas

  • #19446

    Alexander Bautz
    Keymaster

    Hi,
    I see that the built in setFieldValue fails to set a multiselect PP to blank – this will be fixed in the next release.

    To make your custom code update the readonly value, use this line:

    jQuery("#dffs_NAMEOFPEOPLEPICKER .dffs-readonly-inner").html("");

    Change “NAMEOFPEOPLEPICKER” for your PP name.

    Alexander

You must be logged in to reply to this topic.