Automatically strip tags when publish button is hit...

3 posts, 0 answers
  1. Steve
    Steve avatar
    21 posts
    Member since:
    Oct 2007

    Posted 12 Oct 2007 Link to this post

    Excellent took this is for MOSS users. Much better then the built in one... I have been playing with this Lite RadEditor, and I have not been able to figure a few things out... Hopefully someone can help.

    I really like the feature which strips tags like span, font, etc... But You have to manually do this... Is there anyway to automatically strip these tags when the publish button is hit? I do not want any font tags, or span tags included (when people copy from the web), to be included.

    As well, I was wondering is there a way to include some custom JavaScript so that when the Publish button is hit, it will do whatever is in the javascript function?

    Any help would be appreciated.

  2. Rumen
    Rumen avatar
    12788 posts

    Posted 16 Oct 2007 Link to this post

    Hi Steve,

    You can use the FormatStripper tool and the "RADEVENT_SUBMIT" event of RadEditor to achieve your scenario. Here are the configuration steps:
    1. Open the \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\\RadControls\Editor\ConfigFile.xml
      file and register the OnClientLoad event:

        <property name="OnClientLoad">OnClientLoad</property>

    2. Open the page with the <radE:RadHtmlField in Microsoft Office SharePoint Designer and put the following JavaScript inside the PlaceHolderAdditionalPageHead asp:content tag:

      <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
      <script type="text/javascript">
      function OnClientLoad(editor)
         editor.AttachEventHandler ("RADEVENT_SUBMIT", function (e)

             // the code below will call the Format Stripper tool with the "Span" tags
             // the other possible options are All, CSS, WORD_ALL, WORD and SPAN
             oTool = new Object();
             oTool.GetSelectedValue = function() { return "SPAN"; }
             editor.Fire("FormatStripper", oTool);
    3. Save the files.
    4. You can see the attached video demonstrating my test.

    Best regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  3. Steve
    Steve avatar
    21 posts
    Member since:
    Oct 2007

    Posted 16 Oct 2007 Link to this post

    Rumen, thanks a million! This works like a charm! I used the WORD_ALL and it takes out everything I need (so far that I tested at least). As well, I can add more custom JavaScript after this function to do a few other things I want (I have a custom JavaScript written to make sure a table is not bigger then 500 px), and if it is, make it 500 px).

    Now if only the hyperlink tool worked fine, I would be ready to launch my Web Content Management System...

    Again many thanks.
Back to Top