I get strange results on a Visualforce page (yes, Salesforce.com is not good, I know). My problem is that I am trying to use inputField to bind data to a custom sObject, but in my custom controller it does not recognize user input.
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" /> </apex:pageBlockSectionItem> </apex:pageBlockSection>
and here is the code from the controller:
public Fee__c workingFee {get; set;} .... public PageReference saveFee(){ this.workingFee.Trade_Group__c = tradeGroup.id; try{ System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c); upsert workingFee; }catch (System.Dmlexception e){ ApexPages.addMessages(e); return null; } System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c);
I made sure that the workFee property is not null. Whenever I click the "Save Board" 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 - the currency field is not what it expects, what will it be sObject, right?)
The debug statement in the saveFee () method shows that the important workingFee fields are NULL when I expect them to be assigned the values ββentered by the user.
source share