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
LAMCORPLAMCORP 

VForce pages not allowing blank values to be written to the database!

Dear all,

 

Hoping someone can help. I have written a VF page that has input fields.The issue that when there is data in a field and then wanting to enter a blank value, the changes are not written to the database.

 

Does anyone know if this a common issue or is there a solution to this?

 

 

<apex:page standardController="Electricity_Meter__c" recordSetVar="ElecMeters" tabStyle="Electricity_Meter__c" sidebar="false">

<style>
    body {font-family: Arial Unicode MS;}
    h1 {color:black;font-size: 20px;text-decoration: none}
</style>
    <p><h1> Logging Table - Elec Meter(s) </h1></p><p></p>  
    <apex:form >
        
        <apex:pageblock >
        <apex:pageMessage summary="Validation error" severity="warning" strength="3" />
        <apex:pageMessages />
                
        <apex:pageBlockButtons >        
            <apex:commandButton value="Save" action="{!save}" reRender="resultBlock"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>            
        </apex:pageBlockButtons>
        
                <apex:pageBlockTable value="{!selected}" var="elecM">
                
                    <apex:column value="{!elecM.name}"/>
                    <apex:column value="{!elecM.Site_Address2__c}"/>
                    <apex:column value="{!elecM.Meter_Details__c}"/>
                    
                    <apex:column headerValue="Winning Supplier">
                    <apex:inputField value="{!elecM.Winning_Supplier__c}"/>
                    </apex:column>
                                      
                    <apex:column headerValue="Commission (p/kwh)">
                    <apex:inputField value="{!elecM.Required_Commision_p_kwh__c}"/>
                    </apex:column>                    
                    
                    <apex:column headerValue="Commission (£/year))">
                    <apex:inputField value="{!elecM.Required_Commision_Contract__c}"/>
                    </apex:column>
                    
                    <apex:column headerValue="Commission (%/Contract)">
                    <apex:inputField value="{!elecM.Required_Commision_Contract_Spend__c}"/>
                    </apex:column>
                                       
                    <apex:column value="{!elecM.AQ__c}"/>
                    <apex:column headerValue="Annual Consumption as contract">
                    <apex:inputField value="{!elecM.Renw_Contract_Consumption__c}"/>
                    </apex:column>
                    
                    <apex:column headerValue="Start Date">
                    <apex:inputField value="{!elecM.Required_contract_start_date__c}"/>
                    </apex:column>
                    
                    <apex:column headerValue="End Date">
                    <apex:inputField value="{!elecM.Required_contract_end_date_1__c}"/>
                    </apex:column>
                                        
                    <apex:column headerValue="TL Check)">
                    <apex:inputField value="{!elecM.TL_Logging_Check__c }"/>
                    </apex:column>
                                        
                </apex:pageBlockTable>
        </apex:pageBlock>
    
    </apex:form>
</apex:page>