Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

I'm having strange results with a Visualforce page (yes, is icky, I know). My issue is that I am trying to use the inputField to bind data on a custom sObject, but in my custom controller, it is not recognizing the user input data.

Here is the code snippet from the page:

<apex:pageBlockSection title="Enter New Fee" rendered="{!isRenderedFees}" >

    <apex:inputField value="{!workingFee.Fee_Type__c}"  required="True"/>

   <apex:inputField value="{!workingFee.Fee__c}"  required="True"/> 

    <apex:pageBlockSectionItem >

        <apex:CommandButton value="Save Fee" action="{!saveFee}"  immediate="true" />

        <apex:CommandButton value="Cancel" action="{!cancelFee}" immediate="true" />



and here is the code from the controller:

public Fee__c workingFee {get; set;}
public PageReference saveFee(){
    this.workingFee.Trade_Group__c =;
        System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c);
        upsert workingFee;
    }catch (System.Dmlexception e){
        return null;
    System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c);
    //re-render the page
    this.isRenderedFees = False;
    return null;

I've made sure the workingFee property is not null. Whenever I hit the "Save Fee" button after entering the values, it reloads the page and gives me the message "Error: Required fields are missing: [Fee__c]" (note, Fee__c here is a currency field -- it's not that it expects this to be an sObject, is it?)

The debug statement in the saveFee() method shows that workingFee's important fields are null, when I would expect them to have been assigned the values input by the user.

1 Answer

0 votes
by (32.1k points)
edited by

Try writing explicit get/set methods, like:

private workingFee;

public Fee__c getWorkingFee() {

    return workingFee;


public void setWorkingFee(Fee__c value) {

    workingFee = value;


There is no logical reason why this should work any different to:

public Fee__c workingFee { get; set; }

Go for this in-depth job-oriented salesforce training online now! 

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers


108k users

Browse Categories