Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Kaplan 86 posts 139 karma points
    Jan 16, 2012 @ 18:11
    Paul Kaplan
    0

    Excluding javascript from editable content

    It seems that the Richtext editor is the only field type that does not let an editor insert javascript.  The other ones seem to be OK with it.

    I want to prevent our content editors from inserting javascript or cross-site references, to satisfy the security requirements of our IT department.

    We really only need a single line input field, and the Richtext editor is a bit clunky for this purpose.

    So:

    1) Are there any text input fields that somehow can remove javascript?

    or

    2) Is there any way to limit a Richtext field to a single line?

    -- Paul

  • Rodion Novoselov 694 posts 859 karma points
    Jan 16, 2012 @ 18:17
    Rodion Novoselov
    0

    Hi. I suppose that you could prohibit inserting a script tag into a simple textstring field with setting up regex validation on it.

  • awm 187 posts 376 karma points
    Jan 16, 2012 @ 18:24
    awm
    0

    I wonder if you could somehow do it through regex?

  • Paul Kaplan 86 posts 139 karma points
    Jan 16, 2012 @ 22:21
    Paul Kaplan
    0

    From what I've read about using regex, it's far from bullet-proof.  In fact, for all I know Richtext may not be bullet-proof.  I'll throw this problem back at the IT department and see what they come up with.

  • Rodion Novoselov 694 posts 859 karma points
    Jan 17, 2012 @ 07:45
    Rodion Novoselov
    0

    I've just thought that you could also create custom validation logic and hook it to the Document.BeforeSave event.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 17, 2012 @ 08:21
    Jan Skovgaard
    0

    Hi Paul

    The rich text editor should be used for content only. No code like JavaScript or CSS at all.

    Usually I use the texstring multiple to insert JavaScript for stuff like tracking etc.

    As Rodion is suggesting above you're perhaps able to hook into the Document.BeforeSave event and make some logic.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft