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
Kyle GolikKyle Golik 

Error on Input Percentage Fields with VisualForce

Goal: To create a component with VisualForce that will display three columns and function. 

Need: A component built with VisualForce to display three columns for the Sales Manager to split commission on an Opportunity. Ideally will be 3 by 3. The first column will be the Sales Rep column where the Sales Manager will look up the Sales Rep - can always change it to a Text field but ideally lookup. Second column will be the percentage of commission. Third column would be a formula field that displays the total commission for the rep. 

Usually in most use cases there are only two sales reps, why we need three is now with our organization's digital campaigns, a digital specialist is spending time on the sale and it has been agreed that digital specialist get a commission off the sale. The rows (just to specify) are for each rep. 

The Error: 

Error: Attribute value in <apex:inputField> must contain only a formula expression that resolves to a single controller variable or method in Commission_Split at line 14 column 80

The Code: 

<apex:component>
 <apex:pageBlockSection title="Commission Splits" columns="3">

              
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Sales Rep</apex:outputLabel>
<apex:inputField value="{! Opportunity.Commission_1__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Commission_2__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Commission_3__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Precent of Commission/apex:outputLabel>
<apex:inputField value="{! Opportunity.Percent_Rep_1__c}%" style="width:80px"/>
<apex:inputField value="{! Opportunity.Percent_Rep_2__c}%" style="width:80px"/>
<apex:inputField value="{! Opportunity.Percent_Rep_3__c}%" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Total Commission</apex:outputLabel>
<apex:outputField value="{Opportunity.Total_Rep_1__c}" style="width:80px"/>
<apex:outputField value="{Opportunity.Total_Rep_2__c}" style="width:80px"/>
<apex:outputField value="{Opportunity.Total_Rep_3__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>          
</apex:component>
Raj VakatiRaj Vakati
Your Merge Field Syntax is wrong!

It Should be like below 
 
<apex:component>
 <apex:pageBlockSection title="Commission Splits" columns="3">

              
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Sales Rep</apex:outputLabel>
<apex:inputField value="{! Opportunity.Commission_1__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Commission_2__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Commission_3__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Precent of Commission/apex:outputLabel>
<apex:inputField value="{! Opportunity.Percent_Rep_1__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Percent_Rep_2__c}" style="width:80px"/>
<apex:inputField value="{! Opportunity.Percent_Rep_3__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Total Commission</apex:outputLabel>
<apex:outputField value="{Opportunity.Total_Rep_1__c}" style="width:80px"/>
<apex:outputField value="{Opportunity.Total_Rep_2__c}" style="width:80px"/>
<apex:outputField value="{Opportunity.Total_Rep_3__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

</apex:pageBlockSection>          
</apex:component>