locked
remove comma from name in modified field RRS feed

  • Question

  • I'm getting the Modified name from one of my lists (editor), and It's returned as

    number;#lastname, firstname

    I'm able to remove [number;#] using 

    name = $(this).attr('ows_Editor");

    names = name.replace(/[0-9999]/g.'').split(";#");

    and that returns [,lastname, firstname]

    how can I remove the [ , ] in the front of the string so it shows lastname, firstname.

    I've tried, .replace(), substring(), etc. and nothing is removing it

    Tuesday, November 11, 2014 8:38 PM

Answers

  • what you get in the "names" is actually an array that contain two values,

    you can use names =  name.replace(/[0-9999]/g.'').split(";#")[1]; to get the user name.

    it is same as below:

    name = $(this).attr('ows_Editor");

    names = name.split('#')[1];


    Qiao Wei &lt;br/&gt; My blog:<a href="http://blog.goobol.com">http://blog.goobol.com</a>

    Wednesday, November 12, 2014 2:02 AM

All replies

  • what you get in the "names" is actually an array that contain two values,

    you can use names =  name.replace(/[0-9999]/g.'').split(";#")[1]; to get the user name.

    it is same as below:

    name = $(this).attr('ows_Editor");

    names = name.split('#')[1];


    Qiao Wei &lt;br/&gt; My blog:<a href="http://blog.goobol.com">http://blog.goobol.com</a>

    Wednesday, November 12, 2014 2:02 AM
  • Hello,

    You can remove the comma,

    you shoud get the index of that comma nad then remove index,

    Below artical is Helpful

    http://www.mindfiresolutions.com/How-to-get-and-set-the-value-of-a-people-editor-control-programatically-in-SharePoint--960.php

    Regards

    Sarang

    Wednesday, November 12, 2014 7:19 AM