You need to sign in to do that
Don't have an account?
Akash Sil
How to Concatenate multiple field values of the Object and Display it on VF Rich text field?
Hello everyone! I am trying to create a Rich text Field using VF Page where I can use conditions for checkboxes to retreive the values of text fields from "Case" standard object and populate it in the Rich Text Field area by using a custom action button. I am not experienced in Apex coding therefore seeking out for help in correcting my codes.
VF Page:
<apex:page standardController="Case" extensions="textEditorcontroller" action="{!getautopopulatevalue}" >
<apex:form >
<apex:outputPanel style="padding:50px 50px 50px 50px" id="userDetail">
<apex:outputText rendered="true">
<div style="color:black;font-size: 15px;font-weight: bold;align-content: center;margin-top: 10px; margin-left: 10px">
</div>
</apex:outputText>
<apex:pageBlock >
<apex:pageBlockTable value="{!Case}" var="CS">
</apex:pageBlockTable>
</apex:pageBlock>
<div style = "margin-left: 20px; margin-top: 10px">
<apex:commandButton id="AddProofs" value="AddProofs" action="{!getautopopulatevalue}" />
</div>
<!--<div style = "margin-left: 10px; margin-top: 10px">-->
<apex:inputTextarea id="Richtextarea" richText="true" value="{!Allproofs}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
APEX Controller:
public class textEditorcontroller{
public Case cs{get;set;}
public List<Case> Allproofs{get;set;}
public List<Case> csValue {get;set;}
public textEditorController (Apexpages.StandardController stdController){
this.cs = (Case)stdController.getrecord();
}
public void getautopopulatevalue(){
csValue = ([SELECT Document_1__c,Document_1_Comments__c FROM Case
WHERE Case.Id = :cs.Id]);
Allproofs = csValue;
}
}
Thanks
VF Page:
<apex:page standardController="Case" extensions="textEditorcontroller" action="{!getautopopulatevalue}" >
<apex:form >
<apex:outputPanel style="padding:50px 50px 50px 50px" id="userDetail">
<apex:outputText rendered="true">
<div style="color:black;font-size: 15px;font-weight: bold;align-content: center;margin-top: 10px; margin-left: 10px">
</div>
</apex:outputText>
<apex:pageBlock >
<apex:pageBlockTable value="{!Case}" var="CS">
</apex:pageBlockTable>
</apex:pageBlock>
<div style = "margin-left: 20px; margin-top: 10px">
<apex:commandButton id="AddProofs" value="AddProofs" action="{!getautopopulatevalue}" />
</div>
<!--<div style = "margin-left: 10px; margin-top: 10px">-->
<apex:inputTextarea id="Richtextarea" richText="true" value="{!Allproofs}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
APEX Controller:
public class textEditorcontroller{
public Case cs{get;set;}
public List<Case> Allproofs{get;set;}
public List<Case> csValue {get;set;}
public textEditorController (Apexpages.StandardController stdController){
this.cs = (Case)stdController.getrecord();
}
public void getautopopulatevalue(){
csValue = ([SELECT Document_1__c,Document_1_Comments__c FROM Case
WHERE Case.Id = :cs.Id]);
Allproofs = csValue;
}
}
Thanks
You just have to change the type of your AllProofs variable and assign it correctly in your controller:
And in your visualforce, you have to tell the page to rerender the richTextField to get the new value of variable:
If it helped solve your issue, please mark as the best answer.
Best Regards.