Skip to main content Join us at TDX in San Francisco or on Salesforce+ on March 5-6 for the Developer Conference for the AI Agent Era. Register now.
How can a default value be set in a VF page in a long text feild? Currently the default value set in the object feild for comments__c does not populate when the record is entered from the VF page.

 </apex:tab>

                <apex:tab label="Comments" name="CommentsTab" id="tabComments">

                    <apex:pageBlockSection columns="1" id="CommentsPageBlock">

                        <apex:outputField value="{!Inspection__c.Comments__c}" id="Comments" />

                    </apex:pageBlockSection>

                </apex:tab>

 
11 answers
  1. Nov 17, 2015, 1:55 PM
    In the code you have above, you are using inputTextArea.  You should be using inputField if you want the default value to be presented.  For example

     

    <apex:tab label="Comments" name="CommentsTab" id="tabcomments">

    <apex:pageBlockSection columns="1" id="CommentsPageBlock">

    <apex:inputField value="{!Inspection__c.Comments__c}" id="Comments"/>

    </apex:pageBlockSection>

    </apex:tab>

    If you need to use inputTextArea then you will need to pre-populate the value of Comments__c in your controller with the default value.  You can pull this using the describe methods.
Loading
0/9000