Capture User Input in Popup

Forums Dynamic Forms for SharePoint Capture User Input in Popup

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

  • Author
    Posts
  • #20944

    Chandan Kumar
    Participant

    Hi Alex,

    I am new to the DFFS. I have a requirement to create a button Onclick function, which will open a popup with people picker control, where user will select the people. I have to capture the user input people value and append that value in existing people picker column. I tried to look similar requirement in forum but couldn’t find. I am checking if you have existing object/function to handle this scenario.

  • #20948

    Alexander Bautz
    Keymaster

    Hi,
    Start by adding this to a HTML section in one of your tabs:

    <input type="button" onclick="popUpPeoplePickerExample()" value="Show People picker">

    Then add this to your Custom JS:

    function popUpPeoplePickerExample(){
        spjs.dffs.alert({
            "title":"People picker example",
            "msg":"<div id='customPeoplePicker' onkeydown='event.stopPropagation()' style='height:22px'></div>",
            "ok":function(){
                var pp = SPClientPeoplePicker.SPClientPeoplePickerDict.customPeoplePicker_TopSpan, users = pp.GetAllUserInfo(), arr;
                // Get current PP values
                arr = spjs.utility.getFieldValue({"fin":"Requester","key":"loginName"});
                jQuery.each(users,function(i,o){
                    arr.push(o.Key);
                });
                setFieldValue("Requester",arr);
            },
            "cancel":function(){
                // Close dialog
            }
        });
        var schema = {};
        schema.PrincipalAccountType = 'User,DL,SecGroup,SPGroup';
        schema.SearchPrincipalSource = 15;
        schema.ResolvePrincipalSource = 15;
        schema.AllowMultipleValues = true;
        schema.MaximumEntitySuggestions = 50;
        schema.Width = '350px';
        schema.Height = '55px';
        this.SPClientPeoplePicker_InitStandaloneControlWrapper("customPeoplePicker", null, schema);
    }

    You must change “Requester” in the above snippet with the name of the People picker you want to update with the values.

    Let me know how this works out.

    Alexander

You must be logged in to reply to this topic.