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

How to display text area field using VF Page

Hi Experts,

I want to display one text area field (Notes_c) in exist VF Page.

Below is my code.

VF Code:

    <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
    <td width="10%">&nbsp;</td>   

    <td width="2%" align="right"><b></b></td>
    <td width="10%" align="right"><b>Notes :</b></td>         
    <td width="55px" align="right"><b><apex:outputField value="{!MyNotes.Notes__c}"/></b>&nbsp;&nbsp;</td>
    <td width="50px;"><b>&nbsp;&nbsp; </b></td>
    <td width="50px;"><b>&nbsp;&nbsp; </b></td>

Apex Class:

public string ptcid {get; set;}
public WeeklyTimeCards__c MyNotes{get;set;}   

public ProjectWeekTimeCardNewController(ApexPages.StandardController controller){
ptcid =  ApexPages.currentPage().getParameters().get('ptcid');
MyNotes = [select id, Notes__c FROM WeeklyTimeCards__c WHERE id =: ptcid];   
system.debug('##' + MyNotes );

Is the above code correct?
Why we use debug function in class?

Anyone please sort out this.
Thanks in advance.

Jason Reiber [ACS]Jason Reiber [ACS]
Are you asking if the code is correct because you tried it and it didn't work?  If so, then what happens when you try to run this code?

The basic syntax of <apex:outputField value="{!MyNotes.Notes__c}"/>  looks correct to me.

As for the debug statement, you'd use that for exactly what it sounds like, to debug your code.  The debug logs can be accessed by going to Setup->Monitor->Debug Logs