2

I'm trying to remove formatting and in this case, mailto anchor html tags from being copied when I paste into the people picker textbox/field in SharePoint 2010 and have no idea how to go about doing it successfully.

I have tried adding this(from this site)

<head>
  <script type="text/javascript">

    var _fV4UI = true;
    </script>
    <script type="text/javascript">

function disablePasteForRTE()
    {
     Type.registerNamespace("RTE");
     if (RTE)
     {
      if(RTE.RichTextEditor != null)
      {
       RTE.RichTextEditor.paste = function() { RTE.Cursor.paste(true); }
       // Handle Ctrl+V short cut options in rich text editor
       RTE.Cursor.$3C_0 = true;
      }
     }
    }

  </script>
</head>

into my sites v4.master page and this

<body 
style="overflow: auto" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();disablePasteForRTE();" class="nightandday">
</body>

to the body tag and have not seen and changes(Ofcourse, these were added in conjunction to the existing code and not duplicated). Got

Any help please? Thanks.

1

so you are trying to remove the tags from input field you just pasted into, correct? if so, you can use the trigger onblur or onfocus event of the input field and use jQuery to return only the text between the tags. Like so, jQuery("#input").text();

  $(document).ready(function(){
    $("#yourinput").blur(function() { 
    this.value = $(this).text();
  });});

or you can call it within your tag

<input name="" id"yourinput" onblur=removeTag(this) />;

function removeTag(input){
 this.value = $("yourinput").text();}
  • thanks and i forgot to mention i'm not a developer as such but i'm very familiar with some languages(jquery not one). the tags are not visible in plaintext until you hit the resolve button in sharepoint the postback then shows all the html tags copied. basically, i copy and email address from say outlook or skype, the embedded mailto comes along and wont get removed even if paste first then copy from notepad. where would i be needing to add this lines of code though? thanks – shilezi Jan 16 '14 at 21:48
  • I have a few questions: Why are you pasting into the people picker? Do you have access to the master pages and able to make changes? and lastly, are you familiar with the content editor webpart? thank you – user20775 Jan 23 '14 at 19:40
  • thanks, i'm copying and pasting from a bunch of emails in a custom access request webpart(legacy stuff i didnt build) that gets sent to me. Yes, i have access to the master pages and yes also, I am familiar with CEWP's. – shilezi Jan 24 '14 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.