none
[URGENT] new form Infopath related issues RRS feed

  • Question

  • I have developed below custom infopath new form design and Emailaddress field extract email address value from AssignedTo peoplepicker field and javascript is used to extract the values.

    Issue is when i save the below values Emailaddress value alone not getting saved in list but the remaining values getting saved.

    Kindly Help.

    Name

    AssignedTo   (peoplepicker field)

    Emailaddress   (single line of text)

    Save cancel


    Blitz


    • Edited by sree_23 Thursday, July 4, 2019 10:56 AM
    Monday, July 1, 2019 11:01 AM

Answers

  • Hi,

    Modify as below:

    <script type="text/javascript">
    $(function(){
    invokeAfterEntityEditorCallback(onPeoplePickerFieldSet);
    });
    var invokeAfterEntityEditorCallback =  function(func) {
        var old__EntityEditorCallback = EntityEditorCallback;
        if (typeof EntityEditorCallback != 'function') {
            EntityEditorCallback = func;
        } else {
            EntityEditorCallback = function(result, ctx) {
                old__EntityEditorCallback(result, ctx);
            func(result, ctx);
            }
        }
    };
    function onPeoplePickerFieldSet(result, ctx){
    var doc = $.parseXML(result.replace(/\t/gi,''));
    var $xml = $(doc);
    var email= $xml.find('Key:contains(Email) + Value').text();
    if(ctx.indexOf("FormControl0__customcontrol1")!=-1){
    $('#1000000_Formcontrol0_Z1').val(email);
    $('#122220_Formcontrol0_Z5').focus();
    }
    if(ctx.indexOf("FormControl0__customcontrol0")!=-1){
    $('#122220_Formcontrol0_Z5').val(email);
    $('#122220_Formcontrol0_Z5').focus();
    }
    }
    </script>

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by sree_23 Thursday, July 4, 2019 9:31 AM
    Thursday, July 4, 2019 9:23 AM

All replies

  • Hi,

    How did you save the Emailaddress into list ? Jsom code or something else ?

    Please share the code snippet you are using for a better understanding.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Tuesday, July 2, 2019 7:49 AM
  • I am just validating using jquery to extract the people picker field email address to the emailaddress text box but i am not sure how to save the textbox vlaue into the list

    AssignedTO  Test1

    Emailaddress Test1@test.com //extracted Assignedto field emailaddress using jquery


    Blitz

    Wednesday, July 3, 2019 5:24 AM
  • Hi,

    After you populate the email address textbox from the People Picker, you could directly save the value using OOTB save button.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, July 3, 2019 5:31 AM
  • I am  using custom infopath form also emailaddress textbox value is not getting saved in list 

    Blitz

    Wednesday, July 3, 2019 6:12 AM
  • Hi,

    From your previous thread, I find out the code snippet you are using to get email address from People Picker and populate to text box.

    The reason why emailaddress field not saved to list is because of the textbox has been set to disabled, if this textbox is disabled, it can be set value using Jquery, but can't submit data into SharePoint list, so set it to read only in InfoPath and remove this line in your Jquery code:

    Remove the line selected in the capture below in your code snippet:

    Now when set a person in People Picker, it will automatically populate email adress into text box and this textbox can't be set value manually as it is read only.

    Click the Save Button, this email address textbox will be able to save into list:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, July 3, 2019 6:20 AM
  • No its not readonly.thats been validated and textbox values are not read only fields

    Blitz

    Wednesday, July 3, 2019 6:24 AM
  • Hi,

    Key point is that this field control must be not disabled, if disabled, it won't submit data to SharePoint list.

    In my side, I tested with the code in your previous thread, it works in my side, just remove the line which set textbox to disabled.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, July 3, 2019 6:27 AM
  • I am not sure its not working at my side.also fields is not disabled

    Blitz

    Wednesday, July 3, 2019 7:12 AM
  • Hi, 

    So back to the original question now, you can extract email and populate into textbox, and textbox isn't read only or disabled, now you can't save the email address to the list.

    Then how did you save the data ? Using JSOM or OOTB Save Button ? I have tested with OOTB Save Button, it is working, if the textbox is not disabled.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, July 3, 2019 7:25 AM
  • I am not able to save the emailaddress to the list . i am using custom new form infopath and i am trying save from that custom save button hence not sure its not getting saved into list.also i am not using any jsom for saving data.Ideally save button should save the values ,it also saves values for AssignedTo field but this emailaddress textbox only which is populated using above script doesnot get saved in list.

    Blitz


    • Edited by sree_23 Wednesday, July 3, 2019 8:41 AM
    Wednesday, July 3, 2019 8:00 AM
  • Kindly help

    Blitz

    Wednesday, July 3, 2019 12:16 PM
  • Please help if we need to use some jquery for saving these textbox values to store in list.Kindly help as it is urgent.

    Blitz

    Wednesday, July 3, 2019 12:57 PM
  • Hi,

    No need to use any code or custom button. In InfoPath form, there is Save Button in Ribbon menu, you could directly click the Save Button to save the entry, it is working in my side.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, July 4, 2019 12:45 AM
  • Thank you but we would require SAVE button in the form itself hence we are facing issues while saving the item .also its saving intermittently in the list 

    Blitz

    Thursday, July 4, 2019 6:45 AM
  • Hi,

    Add this line in your Js code snippet:

    $("h4>span:contains('Emailaddress')").closest("tr").find("input").focus();
    

    Now the save button can save the email address textbox value.

    Thanks

    Best Regards 


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, July 4, 2019 8:47 AM
  • I am using the below code and please help me in the below code.Thanks in advance

    <script type="text/javascript">
    $(function(){
    invokeAfterEntityEditorCallback(onPeoplePickerFieldSet);
    });
    var invokeAfterEntityEditorCallback =  function(func) {
        var old__EntityEditorCallback = EntityEditorCallback;
        if (typeof EntityEditorCallback != 'function') {
            EntityEditorCallback = func;
        } else {
            EntityEditorCallback = function(result, ctx) {
                old__EntityEditorCallback(result, ctx);
            func(result, ctx);
            }
        }
    };
    function onPeoplePickerFieldSet(result, ctx){
    var doc = $.parseXML(result.replace(/\t/gi,''));
    var $xml = $(doc);
    var email= $xml.find('Key:contains(Email) + Value').text();
    if(ctx.indexOf("FormControl0__customcontrol1")!=-1){
    $('#1000000_Formcontrol0_Z1').val(email);
    }
    if(ctx.indexOf("FormControl0__customcontrol0")!=-1){
    $('#122220_Formcontrol0_Z5').val(email);
    }
    }
    </script>


    Blitz

    Thursday, July 4, 2019 9:19 AM
  • Hi,

    Modify as below:

    <script type="text/javascript">
    $(function(){
    invokeAfterEntityEditorCallback(onPeoplePickerFieldSet);
    });
    var invokeAfterEntityEditorCallback =  function(func) {
        var old__EntityEditorCallback = EntityEditorCallback;
        if (typeof EntityEditorCallback != 'function') {
            EntityEditorCallback = func;
        } else {
            EntityEditorCallback = function(result, ctx) {
                old__EntityEditorCallback(result, ctx);
            func(result, ctx);
            }
        }
    };
    function onPeoplePickerFieldSet(result, ctx){
    var doc = $.parseXML(result.replace(/\t/gi,''));
    var $xml = $(doc);
    var email= $xml.find('Key:contains(Email) + Value').text();
    if(ctx.indexOf("FormControl0__customcontrol1")!=-1){
    $('#1000000_Formcontrol0_Z1').val(email);
    $('#122220_Formcontrol0_Z5').focus();
    }
    if(ctx.indexOf("FormControl0__customcontrol0")!=-1){
    $('#122220_Formcontrol0_Z5').val(email);
    $('#122220_Formcontrol0_Z5').focus();
    }
    }
    </script>

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by sree_23 Thursday, July 4, 2019 9:31 AM
    Thursday, July 4, 2019 9:23 AM
  • Thanks a lot for your quick help.working as expected.

    Blitz

    Thursday, July 4, 2019 9:32 AM