+ Start a Discussion
sfadmin 182sfadmin 182 

wrapper object not updating input values back to controller

I have a wrapper object which nests a couple of custom sobjects within it, one of these is an account. When I reference the account in a table in visualforce the data gets loaded just fine, but when I make changes to it seems like the values are not getting set in the controller record:

(These will all be snippets of a larger page/class but all relevant code has been provided)

visualforce page: (i tried both inputField and inputText but it still doesnt work)
<apex:pageBlock rendered="{!showCompanyEditSection}">   
                <apex:sectionHeader title="Company Edit" subtitle="{!if(editCompanyWrapper.isNew =true,'New Account', editCompanyAccount.Name)}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-1" label="Name" value="{!editCompanyAccount.name}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-1" label="Full Legal Name" value="{!editCompanyAccount.full_Legal_Name__c}"/>
                    <apex:inputtext  styleclass="slds-input slds-size_1-of-2" label="ABN" value="{!editCompanyAccount.abn__c}"/>
                    <apex:inputField  styleclass="slds-input slds-size_1-of-2" label="ACN" value="{!editCompanyAccount.acn__c}"/>
                    <apex:inputField  styleclass="slds-input slds-size_1-of-2" label="ACN" value="{!editCompanyAccount.type}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-1" label="Street" value="{!editCompanyAccount.billingStreet}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-1" label="City" value="{!editCompanyAccount.billingCity}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-4" label="State" value="{!editCompanyAccount.billingState}"/>
                    <apex:inputField styleclass="slds-input slds-size_1-of-4" label="Postal Code" value="{!editCompanyAccount.billingPostalCode}"/>

controller: (the first debug is showing no change to the fields in the nested account (guaranteeAccount)
// first validate account data
        system.debug('### [saveEditCompany] editCompanyWrapper: ' + editCompanyWrapper);
        if(validateAccountData(editCompanyWrapper.guaranteeAccount) == false){
            ApexPages.Message msgError = new ApexPages.Message(ApexPages.Severity.ERROR,'All Account information must be completed before saving.');
            return null;

    private boolean validateAccountData (Account pAcc){
        if(pAcc.Name == null || pAcc.Full_Legal_Name__c == null || pAcc.BillingStreet == null || pAcc.BillingCity == null || pAcc.BillingState == null || pAcc.BillingPostalCode == null){
            return false;
        else return true;
wrapper class:
    public class GuaranteeAccountWrapper {
        public boolean                 isNew                        {get;set;}
        public Boolean                 active                       {get;set;}
        public Company_Guarantee__c    companyGuarantee             {get;set;}
        public Account                 guaranteeAccount             {get;set;}
        public GuaranteeContactWrapper[] companycontactWrappers     {get;set;}

    public  GuaranteeAccountWrapper             editCompanyWrapper      {get{ return companyGuaranteeWrappersMap.get(accId);}set;}
    public  Account                             editCompanyAccount      { get{ return companyGuaranteeWrappersMap.get(accId).guaranteeAccount;} set;}

I dont know what is going on, why arent values getting passed back to the controller.
Best Answer chosen by sfadmin 182
sfadmin 182sfadmin 182
SOLVED IT! Problem was the ActionRegion encapsulating the saveEditCompany button (which i did not add in the code, sorry for that) since the actionregion was also including this button when clicked the account edit panel was not being sent back to the server.