You need to sign in to do that
Don't have an account?
RupaliJ
RichText Area not removing HTML Tags
Hi,
I am developing a Send Email Module to add some more functionality. I have a Rich text area to show selected template body.
<apex:inputtextarea richtext="true" value="{!body}" id="body"/>
{!body} is string property. Suppose Template is as below :
Dear {!Contact.FirstName}, I really enjoyed speaking with you today. I think that {!Organization.Name} has a lot to offer {!Account.Name} and I look forward to our next meeting.Regards, {!User.FirstName}
When I edit template body to :
Dear {!Contact.FirstName}, I really enjoyed speaking with you today. I think that {!Organization.Name} has a lot to offer {!Account.Name} and I look forward to our next meeting. Waiting for you reply. Regards, {!User.FirstName}
then in controller I get template with HTML tags
Dear {!Contact.FirstName}, I really enjoyed speaking with you today. I think that {!Organization.Name} has a lot to offer {!Account.Name} and I look forward to our next meeting. <br/> Waiting for you reply. <br/> Regards, {!User.FirstName}
Can anyone help me to resolve this? Trying hard to avoid html tags but no success :(
Use regex
body = body.replaceAll('<[^>]+>',' ');
It will solve the problem.
All Answers
Use regex
body = body.replaceAll('<[^>]+>',' ');
It will solve the problem.