function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sangeet kaseraSangeet kasera 

How to insert Output Text Data inside the Input field using command button?

Hi All,

I have one Visualforce page Which has one rich text area comment body, I just want to fetch one Email Template using command button and insert it inside comment body field. Please help me out to solve this issue.

Rich text area comment body
User-added image

Apex Controller-

public EmailTemplate mailBody {get;set;}
public String CheckBody {get;set;}
public pageReference InsertTemplate(){
EmailTemplate mailBody = [SELECT id,name, subject,HtmlValue, Body FROM EmailTemplate WHERE id='00X6F000002ZhmpUAC' ];
System.debug('templateBody'+mailBody.Body);

CheckBody = mailBody.Body;
System.debug('CheckBody'+CheckBody);
return null;
}

Visualforce Page- 
<apex:pageBlockSection columns="1">
    <apex:inputCheckbox value="{!cmt.IsPublished}" label="Public"/>
        <div style="margin-bottom:15px;">
        <apex:inputfield id="ccBody" label="Comment" styleClass="" value="{!workingCase.Case_Comment__c}"  rendered="{!setting.Enable_RichText_Comment__c}">
            <apex:outputText value="{!CheckBody}"></apex:outputText>
        </apex:inputfield>

    <!--  <apex:inputtextarea id="ccBody1" label="Comment"  styleClass="cmntBody" value="{!workingCase.Case_Comment__c}" rendered="{!not(setting.Enable_RichText_Comment__c)}" cols="100" rows="15">
    <apex:outputText value="{!CheckBody}"></apex:outputText>
    </apex:inputtextarea> -->
    <apex:inputHidden value="{!nonStaticAttachmentIdType}" id="myHiddenField"/>
        <apex:actionFunction name="passStringToController" action="{!getAttachmentvalues}" rerender="myHiddenField"/>
    </div>
</apex:pageBlockSection>

When I am printing both variable i dont know why mail body is coming blank.
Checkbody Data=== {!CheckBody}
Mail Body Data ==={!mailBody.Body}

 <apex:outputText value="{!CheckBody}"></apex:outputText>
This Output text I wan to shiw inside comment body when i click on command button.

Regards,
Sangeet