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
Francisco RuedaFrancisco Rueda 

Visualforce Field is Always Null in the Extension Class

Hi all,

I have the following code in a Visualforce page:
<apex:inputField value="!OPR.New_Monthly_Revenue_NA__c}" rendered="{!OPR.Type_of_Implementation__c=='Audio Only'|| OPR.Type_of_Implementation__c=='Audio / Web' ||                                      OPR.Type_of_Implementation__c=='ECC-Lync' || OPR.Type_of_Implementation__c=='ECC-ResPlus'}" required="true"/>
Where OPR is an instance of an object in the extension class. And in that extension class, I have the following code:
OPR.New_Monthly_Revenue_APAC__c = OPR.New_Monthly_Revenue_APAC__c / oldRate * newRate;
The problem I have is that, when executed that part (and I've verified that it's being executed), OPR.New_Monthly_Revenue_APAC__c is always null, even if I set a value in the inputField in the VF page.

What am I missing?
Atla Satheesh 8Atla Satheesh 8
Hi Francisco,

ARe you suing standard controller/custom controller.

Please send the total code of VF page and controller, so that i can help you
 
Francisco RuedaFrancisco Rueda
Hi Atla,

This is the apex:page part of it:
<apex:page standardController="Opportunity_PM_Request__c"
           extensions="sendPMRequestExtension"
           lightningStylesheets="true">
That Opportunity_PM_Request__c object is the one instantiated with OPR. Any other operations against the controller work fine. I'm even doing the same assignation against another field (outputField, not inputField, just in case it matters) and it works:
OPR.Total_Contract_Value__c = OPR.Total_Contract_Value__c / oldRate * newRate;
Francisco RuedaFrancisco Rueda
Just wondering.

The VF part in which it's been executed is:
<apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.Opportunity_PM_Request__c.Fields.CurrencyIsoCode.label}"></apex:outputLabel>
                        <apex:actionRegion >
                            <apex:inputField value="{!OPR.CurrencyIsoCode}" required="true" id="currency">
                                <apex:actionSupport event="onchange" action="{!updateCurrencies}" rerender="totalContractValue, audio"/>
                            </apex:inputField>
                        </apex:actionRegion>
                </apex:pageBlockSectionItem>
Do the rerender acts before or after executing the action? Maybe that's the problem.