+ Start a Discussion
AdilewaAdilewa 

Text area formatting

I have an text area field for the description of my case.
<apex:inputTextArea label="Description" value="{!Case.Description}" cols="120" rows="10" />

and for the view the output is as follows:
<apex:outputText label="Description" value="{!Case.Description}" style="word-wrap:break-word;white-space: normal" />

If I enter a lot of information with brakes or any type of formatting, after I save it, it turns into a one paragraph, no format at all.
I tried the word wrap CSS style, but still doing the same thing. Any ideas?
User-added image
Best Answer chosen by Adilewa
Mohit Bansal6Mohit Bansal6
Did you use it as OutputText or OutputField?

Use it directly as <apex:outputField label="Description" value="{!Case.Description1}"  />


Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help

All Answers

Mohit Bansal6Mohit Bansal6
Hi Adilewa

Create a new field on Case Object of type "Rich Text", and don't add it to pagelayout. Just use this field for displaying value on visualforce page.
Now assign the description value to this new field and use this new field on visualforce page and i am sure, text will come perfectly alligned.


Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
AdilewaAdilewa
So, I created a new rich text field and called it Description1, leave the view to all profiles, and didn't add it to any page layout.
Then I added it to my visualforce pages, still same thing. I also tried the richtext="true" attribute, but still not working... :_(
However, it does add the <br> after saving it.

User-added image
 
Mohit Bansal6Mohit Bansal6
Did you use it as OutputText or OutputField?

Use it directly as <apex:outputField label="Description" value="{!Case.Description1}"  />


Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
This was selected as the best answer
Mohit Bansal6Mohit Bansal6
Is it working fine?
AdilewaAdilewa
Yes!!!!!!!! Thank you!!!! now both show correclty... :|
Mohit Bansal6Mohit Bansal6
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
AdilewaAdilewa
Sorry, one more question, how about when binding a controller property to an outputfield to get the same response?
I'm getting the next following message: Error: Could not resolve the entity from <apex:outputField> value binding '{!comment.commentText}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
Mohit Bansal6Mohit Bansal6
You cannot do it. We cannot bind outputField with controller property. Regards Mohit Bansal
Mohit Bansal6Mohit Bansal6
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
azhar khasimazhar khasim
Hello Mohit,

I have facing the same issue 
In which

I Had a Field (Allotment Summary) Long TextArea Field in Bren Updates(Custom Object).
I need to display the data which was in Allotment Summary in the Visualforce Page.

I have tried it using <apex:outputField>  Which was in Bold downwards in code.
But still i was not getting the data to show in Visualforce page.

My Visualforce Page:
==========================================================================================================

<apex:page controller="BookingLinkQuestionary" showHeader="false" sidebar="false">
    
    <style>
        body {
        background-image: url("https://www.bren.com/residential/images/home-banner11.jpg");
        
        
        }
        input[type="text"] {
        background: transparent;
        
        }        
    </style>  
    
    <apex:form >
        
        <style>
            body .bPageBlock .pbBody .fontcolor .pbSubheader h3{
            color:#ffffff;
            
            
            }
            body .bPageBlock .pbBody .blue .pbSubheader{
            background-color:#02a3d6;
            font-style:Aparajita;
            }
        </style>
       
        <apex:sectionHeader title="Bren Online Booking Form" />
       
        <apex:pageBlock >
        
             <center>
                <apex:image url="https://bren--partial--c.cs31.visual.force.com/resource/1523623530000/BrenLogo"/>
            </center>
            
            <apex:pageBlockButtons location="bottom" style="float:left;" >  
                
                <font size="4" style="color:red; float:left;" face="Ancillary Bold"><b>NOTE:Please click on 'Accepting Terms and Conditions ' checkbox before submitting the data to Bren Corporation.</b> </font>
                <br/>
                <center>
                    <apex:commandButton style="color:white; background-color:green; background-image:none; width:150px; height:35px" action="{!Submit}" value="Submit"  />
                    <apex:commandButton style="color:white; background-color:red; background-image:none; width:150px; height:35px" action="{!cancel}" value="Cancel"  />  
                </center>
            </apex:pageBlockButtons>
            
               
            <center>
                <font size="5" style="color:blue" face="Foobar Pro Bold" ><b>Welcome to Bren Online Booking Portal</b> </font>
            </center>
            
            <center>
                <font size="4" style="color:red" face="Foobar Pro"><b>Bren Terms of Allotment.</b> </font>
            </center>
             <br/><br/>
            <apex:outputPanel styleClass="blue" layout="block" >
                
                <apex:pageBlockSection title="Allotment Summary" collapsible="false"  columns="1">
                      
                 <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Allotment Summary" for="AllSum" style="font-family:Ancillary Bold; font-size:15px" />
                     <apex:outputField value="{!brenup.Allotment_Summary__c}" id="AllSum" />
                   <!--    <apex:inputfield value="{!booking.Allotment_Summary__c}" id="AllSum" html-disabled="true" />  -->
                 <!--   <apex:inputTextarea richtext="true" value="{!booking.Allotment_Summary__c}"  id="AllSum" readonly="true" cols="60" rows="15"/>  -->
                  <!--   <apex:inputTextarea richtext="true" value="{!brenup.Allotment_Summary__c}"  id="AllSum" readonly="true" cols="60" rows="15"/>  -->
                           

                    </apex:pageBlockSectionItem>   
                                    
                </apex:pageBlockSection>
            
            <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q1. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q2. What is the full name of Bren corporation?</b> </font>
                
                <br/><br/><br/><br/>
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q3. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
                
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q4. What is the full name of Bren corporation?</b> </font> 
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q5. What is the full name of Bren corporation?</b> </font>         
                
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q6. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q7. What is the full name of Bren corporation?</b> </font>
               
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q8. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q9. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q10. What is the full name of Bren corporation?</b> </font>
                 
                <br/><br/><br/><br/>
                
                 <br/>
              <apex:inputCheckbox style="color:black; width:20px; height:20px" required="true" value="{!isboolean}"/>  
           <!--     <apex:inputField style="color:black; width:25px; height:25px" required="true" value="{!booking.I_Accept__c}"/> -->
            <font size="4.5" style="color:red" face="Foobar Pro Bold" ><b>Accepting Terms and Conditions</b> </font>

                 <br/>  <br/>  
            <font size="3" style="font-family:Ancillary Bold; color:blue"><b>DECLARATION :
                
                I / WE the Applicant/s do hereby declare that the above-mentioned particulars / information given by me / us are true and genuine to my / our best knowledge and the same are irrevocable. 
                I / WE also declare the booking terms referred to above at SL.No.1 to 14 are read over to me / us and I / WE, after understanding the said conditions are willing to book the Apartment noted above.
                
                
                </b></font>   
            
            </apex:outputPanel>
        
        </apex:pageBlock>
    </apex:form>
</apex:page>


==========================================================================================================
My Controller Class:
==========================================================================================================
public class BookingLinkQuestionary {
    
     public Booking_Link__c booking {get;set;}
    public Boolean isboolean {get;set;}
    public string BrenUpdateId{get;set;}
    public Bren_Update__c brenup {get;set;}
   // public Boolean isboolean {get;set;}
    
     public BookingLinkQuestionary(){
        booking = new Booking_Link__c();
       
    }
  //  public checkLongArea(ApexPages.Controller cont){
  //  BrenUpdateId = ApexPages.CurrentPage().getParameters().get('id');
  //  brenup = [SELECT id , LongTextAreA__c FROM Bren_Update__c WHERE id =: BrenUpdateId];
  //  system.debug('##' + brenup);
    

//}
    public void Submit(){
        try{
            if(isboolean){
                INSERT brenup;
            } else{
                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,''+'No records to Display"'));
            }
        }catch (Exception e) {
            ApexPages.addMessages (e);
           
        }
        
    }
     public void cancel(){
        booking = new Booking_Link__c();
    }

}


Please help me out from this...

Any help is highly appriciated.

Thanks and Regards,
Azhar Khasim.