You need to sign in to do that
Don't have an account?
Jeff_SF
Set default value for text feild in VF page
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>
</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>
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.
All Answers
NOTE: When adding code, please use the "Add a code sample" button (icon <>)
Yes thenk you, InputFeild, above is the code sample. When a new record is entered from the VF form, the default value set for the feild does not populate the feild in the form. Does the default value need to be included in the code?
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.
Error:j_id0:inspect:detail:CSPageBlock:j_id34:CS: Validation Error: Value is required.
It is pointing to this line. This required customer value is in the form when trying to save...
controller:
When a new record is created the field in question is blank.It does populate when the record is saved only if no value is entered in the blank field when a new record is created. The purpose of the default text is to guide/instruct the user what info to enter - it is rather lengthy. In order to get the proper instruction, the user must leave the field blank when creating a new record and then go back into edit mode to get the intructions (populated with the default text). Any suggestions on how to get around this? the same form is being used for NEW and EDIT actions. Am using version 18.0 API. The VF page would not post - had too many lines to post.