Skip to main content
Inspiring
July 31, 2018
Answered

Problems with cfdocument and getSafeHTML()

  • July 31, 2018
  • 1 reply
  • 636 views

I have a site where users can fill out reports.  The admins have the ability to control the questions.  So, I'm using GetSafeHTML() when I show the questions because there are some questions that have bulletted lists and EncodeForHTML when displaying the answers.  That all works fine when displaying the questions and answers to the screen.  However, the user also has the option to save the report as a pdf.  I'm using cfdocument to create the pdf.  My problem is that anything with GetSafeHTML is showing the html (ie <ul><li>, etc.) for the list instead of just displaying the bulleted list.

Anyone else having similar problems?  Any thoughts on work arounds?  I am thinking of using IsSafeHTML and only displaying if it is safe and no longer using GetSafeHTML to display.  Anyone deal with this differently?

    This topic has been closed for replies.
    Correct answer WolfShade

    Have you tried putting the content within canonicalize()?  Have you tried using CFPDF?

    V/r,

    ^ _ ^

    1 reply

    WolfShade
    WolfShadeCorrect answer
    Legend
    July 31, 2018

    Have you tried putting the content within canonicalize()?  Have you tried using CFPDF?

    V/r,

    ^ _ ^

    DeliKAuthor
    Inspiring
    July 31, 2018

    Turned out to be a versioning problem...

    The site is running on CF11 and I'm developing on CF2016, which is what they are moving to next month.

    On CF11, getSafeHTML() doesn't work with cfdocument/pdf.  Canonicalize() does work on both cf11 and cf2016 when outputting html, so that's what I'm using in this case.  On CF2016, getSafeHTML() works fine with cfdocument/pdf.

    I didn't try cfpdf. 

    WolfShade
    Legend
    July 31, 2018

    Glad you got it working.  And thank you for marking my answer correct.  I do appreciate it.

    V/r,

    ^ _ ^