0

I have VF page in which i have a output text like the below one.

<apex:outputText value=" {!SUBSTITUTE(JSENCODE(title),'\n','<br/>')}" escape="false"/>

Lets say the value of the title attribute is "Demo car's result".

when i print this page or render it as PDF, the value displays as "Demo car\'s result".

I want to Js encode the attribute but when rendering as pdf i don't want this backslash to be displayed.

Please let me know if there is a way to do it.

Thanks in advance.

1

You would want only the input which would be passed to apex controller to be JSENCODE. But you are doing output, so you dont really need JSENCODE - without it, the rendering will be done properly.

<apex:outputText value=" {!SUBSTITUTE(title,'\n','<br/>')}" escape="false"/>
  • Thanks for the clarification. – Sisir Aug 28 at 10:15

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.