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
Adan SantosAdan Santos 

<apex:inputField> not sending updated value to controller

Hello guys, I'm having a weird behavior with <apex:inputField>...

When the page loads, it receives the value from a Map variable on from it's controller, but when i change the value and click the SAVE button, it's value doesn't get updated. When debug the Map variable still has its original values.

VF:
 

<apex:pageBlockSection id="pbsModalidade" columns="1" title="{!segmento.Codigo__c} {!segmento.Nome_Segmento__c}" collapsible="true">
            <apex:inputField value="{!objetivosMP[grupo.id].Meta__c}" rendered="{!NOT chancelar}"></apex:inputField>
</apex:pageBlockSection>
 


Controller: 
 

public Map<Id, Objetivo__c> objetivosMP {get; set;}

public void save() {
      for (Id idGrupo: objetivosMP.keyset()){
            System.debug('objectives ' + objetivosMP.get(idGrupo));
      }
}

Anyone, can help me?
Shashikant SharmaShashikant Sharma
Hi Adan,

Could you please share full code of VFP which has Save Button action.

Thanks
Shashikant
Adan SantosAdan Santos

Thank you, Shashikant, but I already solved this issue.

The problem was due to a duplicated inputField that was hidden with css, it wasn't visible on the page, but it was there... Therefore this second hidden input was the one controller was getting the old value.

 

Shashikant SharmaShashikant Sharma
I knew that somethign was on the code which was not shared in above code that is why I asked for full code.

Happy that you resolved your issue. It would be good if you could still post the full code and mentioned the cuase and resolution of problem. And then marked this post as resolved so others could be benefitted from it. 

Thanks
Shashikant