+ Start a Discussion
Ravichandra sindheRavichandra sindhe 

how to display data from rich text area to text area

Hi all,

i need help on displaying a data from rich text area to text area with a same formate which a maintain data in rich text area

ex: below formate i kept in rich text area..i need to display same formate in text area..but its not happening..its just remove spaces and display the data

Hi all,

i need help on displaying a data from rich text area to text area with a same formate which a maintain data in rich text area

Deepali KulshresthaDeepali Kulshrestha
Hi Ravichandra,

Rich ext area field can also contain images. when we have images in rich text area field we can not copy it to the textarea field because <textarea> element can only hold plain text, not other nodes. If you just want to copy the plain text you can do as such:
<textarea><apex:outputtext value="{!objName.richTextAreaFieldName}" escape = "false"/></textarea> 

Here escape = "false" attribute on outputtext renders the content escaping HTML tags.

If you want to do it in javascript: 
<apex:outputtext id="richVal" value="{!objName.richTextAreaFieldName}" escape = "false"/>
<textarea id="someId" rows="4" cols="50"></textarea>

<script>
document.getElementById('someId').value = document.getElementById({!$Component.richVal}).value;
</script>
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.
Ajay K DubediAjay K Dubedi
Hi Ravichandra,

You can display the data from the rich text area to text area with the same format which maintains your data.

'{!variable}' contains the rich text area data.

In Lightning:-
You can use this-

 <aura:unescapedHtml value="{!variable}"/>
 
In Visualforce Page:-
You can use this-

 <apex:outputText value="{!variable}" escape="false"/>

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi