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
Erik LarameeErik Laramee 

VF page - Field behavior when creating new record

I am the kind of person that 'knows enough to be dangerous' so I am trying to make a change to a VF page and having some difficulty with it. We use one VF page for New and Edit buttons for a custom object. Currently, we have a field 'Tax Group" that is read only on creation but editable after the record has been created. I'd like to change the 'Tax Group' field that displays on creation to a formula field from another object. A 2nd but less preferable solution is to hide the field from view with creating the record. Formula field (percent field type) is straightfoward - Object__r.Tax_Percent__c. This is what the section of that page currently looks like.

        <apex:pageBlockSection columns="2" title="Purchase Order Changes" collapsible="false"> 
                    <apex:inputField value="{!Con_Req__c.Tax_Rate__c}" rendered="{!taxExempt == false}"/>
                    <apex:outputField value="{!Con_Req__c.Tax_Rate__c}" rendered="{!taxExempt}"/>                         
                </apex:pageBlockSection> 

I've tried changing the first line under the page block section to this, hoping it was a simple tweak:
<apex:inputField value="{!Con_Req__c.Tax_Rate__c}" rendered="{!taxExempt == !Object__r.Tax_Percent__c}"/> but I get an error -
Unknown property 'Con_Req__cStandardController.Object__r'

This is the first line on the VF Page with the controller statement.
<apex:page standardController="Con_Req__c" extensions="con_req" action="{!setProj}">

Is anyone able to helpwith this? Again, being able to hide the field is an option if displaying the formula field is not.

Many thanks!
 
VineetKumarVineetKumar
Can you paste your VF page and controller code here. Do use the <> in the editor to paste your code