Skip to main content
Known Participant
August 17, 2010
質問

How to strip HTML out of the form field but leave the basic user formatting?

  • August 17, 2010
  • 返信数 1.
  • 572 ビュー

What would you recommend to automatically strip out HTML that a user has entered into a form field? At the same time we need to preserve the basic formatting that was submitted by the users  i.e. replace <p> tags with CRLF, etc. StripHTML function is perfect but it removes all HTML and therefore, all formatting. Is there anything more flexible?

Thanks!

    このトピックへの返信は締め切られました。

    返信数 1

    ilssac
    Inspiring
    August 17, 2010

    Do you need to strip it, or just render it inoperable.

    The latter can be done with the htmlEditFormat() and htmlCodeFormat() functions.

    If you want the striping, take a look at related functions at the http://www.cflib.org site.   I know I have seen HTML replace functions that had the ability to be configured to strip and|or not strip a select list of tags.

    StripHTML() may actually have this feature (I believe it is hosted at cflib.org).  You may just need to see the documentation on how to configure it thus.