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
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.<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>
I created another form for entering data without the comments fieild. Once record is saved the field populates. It can be edited using a different form that includes the comments field. It is a two step process for data entry, not pretty but it is working. Thanks for the help. I did find a missing required feild and no longer getting the error. 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. I have almost the exact same VF page and it works fine for me. What version of the API are you running? And you are 100% certian that there are no other required fields that Salesforce could be confusing and not saving the record because of? Can you provide your entire visualforce page? <apex:page standardController="Student__c">
<apex:form >
<apex:inputField style="width: 300px; height: 300px;" value="{!Student__c.long_text__c}" required="true"/>
<apex:commandButton action="{!save}" value="Save" />
</apex:form>
</apex:page>
save action:
<apex:pageBlockButtons location="both">
<apex:commandButton action="{!save}" value="Save" />
<apex:commandButton action="{!cancel}" value="Cancel" />
</apex:pageBlockButtons>
controller:
<apex:page standardController="Inspection__c" showHeader="true">
Are you using a custom controller on this page or a Standard controller? Are you using the standard save action or a custom action? that code worked great to expand the area but the default value for field is no longer populating in a new record. Also I am getting an error when tryin to save the record:Error:j_id0:inspect:detail:CSPageBlock:j_id34:CS: Validation Error: Value is required. It is pointing to this line.
<apex:inputField value="{!Inspection__c.Customer__c}" id="customer" required="true" />
This required customer value is in the form when trying to save...
You can modify the style of the inputField and set the height and width to what you need <apex:inputField style="width: 300px; height: 300px;" value="{!Inspection__c.Comments__c}" id="Comments" />
I need a larger area for inputting the data than is available for the standard inputFeild. Is there a way to resize this input feild in the VF form? If not I would need more information on where to find the controller since I am a newbee...
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?</apex:tab>
<apex:tab label="Comments" name="CommentsTab" id="tabcomments">
<apex:pageBlockSection columns="1" id="CommentsPageBlock">
<apex:inputTextarea cols="200" rows="15" value="{!Inspection__c.Comments__c}" id="Comments"/>
</apex:pageBlockSection>
</apex:tab>
답변 11개