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
ConverseManConverseMan 

date field not updating

I am pretty new to coding and have pulled the majority of my code from examples that I've seen online via the community. For the most part I've learned lots and have a functioning page that works how I envisioned. However, there is (1) field that is causing me grief. 

I am using VisualStrap: http://blogforce9.blogspot.com/2013/12/visualstrap-visualforce-implementation.html 
&
I am using his Modal idea: http://blogforce9.blogspot.com/2014/06/visualstrap-using-modals-in-visualforce.html

All seems to be working very well except the Due Date field (due_date__c). It will not update the field value in the panel when Save is clicked on the Modal. All other fields update upon Save in the Modal as expected. Due Date will not.

Visualforce Page (truncated)
 
<apex:form >
            <vs:row >
                <vs:column type="col-md-12">
                    <vs:panel title="{!rfqObj.Name}" type="primary" id="RFQRecordDetailPage">
                        <apex:PageBlock mode="maindetail" id="rfqPageBlock">
                            <apex:pageBlockButtons location="top" >
                                <a class="btn btn-info btn-sm" onclick="$('#EditRfqDetails').modal('show');return false;">Edit</a>
                                <a class="btn btn-info btn-sm" onclick="$('#submitRFQ').modal('show');return false;">Submit</a>
                                <vs:tooltip text="Use this if the Quote has NOT gone to the customer">
                                    <apex:commandButton action="{!ext_RFQ_deepClone_Revise_RFQ_and_CQ}" value="Revise RFQ and CQ" styleClass="btn btn-info btn-sm"/>
                                </vs:tooltip>
                                <vs:tooltip text="Use this if the Quote HAS gone to the customer">
                                    <apex:commandButton action="{!deepCloneRFQ}" value="Revise Quote" styleClass="btn btn-info btn-sm"/>
                                </vs:tooltip>
                                </apex:pageBlockButtons>
                            <br/>
                            <apex:pageBlockSection title="Information" collapsible="True" >
                                <apex:outputField value="{!rfqObj.Locked__c}"/>
                                <apex:outputField value="{!rfqObj.Unlock__c}"/>
                                <apex:outputField value="{!rfqObj.Old_Quote_Number__c}"/>
                                <apex:outputField value="{!rfqObj.Quoting_Priority__c}"/>
                                <apex:outputField value="{!rfqObj.Quote_Number__c}"/>
                                <apex:outputField value="{!rfqObj.Requested_By__c}"/>
                                <apex:outputField value="{!rfqObj.End_User__c}"/>
                                <apex:outputField value="{!rfqObj.Ready_to_Submit__c}"/>
                                <apex:outputField value="{!rfqObj.Submitted_Date__c}"/>
                                <apex:outputField value="{!rfqObj.Revision_Notes__c}"/>
                                <apex:outputField value="{!rfqObj.Due_Date__c}"/>
                                <apex:outputField value="{!rfqObj.RFQ_Stage__c}"/>
                            </apex:pageBlockSection>
                        </apex:PageBlock>
                    </vs:panel>
                </vs:column>
            </vs:row>
            
            <vs:modal id="EditRfqDetails" title="RFQ Details">
                <apex:outputPanel layout="block" id="EditRfqDetailsModal">
                    <apex:pageBlock mode="maindetail">
                        <apex:pageBlockSection title="Information" collapsible="True" >
                            <apex:inputField value="{!rfqObj.Locked__c}"/>
                            <apex:inputField value="{!rfqObj.Unlock__c}"/>
                            <apex:inputField value="{!rfqObj.Old_Quote_Number__c}"/>
                            <apex:inputField value="{!rfqObj.Quoting_Priority__c}"/>
                            <apex:inputField value="{!rfqObj.Quote_Number__c}"/>
                            <apex:inputField value="{!rfqObj.Requested_By__c}"/>
                            <apex:inputField value="{!rfqObj.End_User__c}"/>
                            <apex:inputField value="{!rfqObj.Ready_to_Submit__c}"/>
                            <apex:inputField value="{!rfqObj.Submitted_Date__c}"/>
                            <apex:inputField value="{!rfqObj.Revision_Notes__c}"/>
                            <apex:inputField value="{!rfqObj.Due_Date__c}"/>
                            <apex:inputField value="{!rfqObj.RFQ_Stage__c}"/>
                        </apex:pageBlockSection>
                    </apex:pageBlock>
                    <center><apex:outputPanel layout="block" styleClass="modal-footer">
                        <apex:commandButton value="Cancel" styleClass="btn-warning btn-sm" html-data-dismiss="modal"/>
                        <apex:commandButton value="Save" styleClass="btn-success btn-sm" onclick="$(this).button('loading')" html-data-loading-text="Saving..." action="{!save}" reRender="RFQRecordDetailPage,EditRfqDetailsModal"/>
                        </apex:outputPanel></center>
                    <apex:outputPanel rendered="{!isSuccess}">
                        <script>
                        $('#EditRfqDetails').modal('hide');
                        </script>
                    </apex:outputPanel>
                </apex:outputPanel>
            </vs:modal>

Controller (truncated)
 
public class RFQModalDesignCon {

    public Boolean isSuccess{get;set;}
    public Parameters__c parObj{get;set;}
    public RFQ__c rfqObj{get;set;}
    public ControlsQuoting__c cqObj {get;set;}
    public List <RFQ__c> rfqRecords {get;set;}
    public List <ControlsQuoting__c> cqList {get;set;}
    public List <RFQ__c> RFQs {get;set;}
    private ApexPages.StandardController standardController;
    string lockedRFQRecordTypeId;
    string lockedParamRecordTypeId;
    string lockedMaterialConveyedRecordTypeId;
    string lockedControlsQuotingRecordTypeId;

    public RFQModalDesignCon() {
        
        insertPar();
        parObj.Related_RFQ__c = ApexPages.currentPage().getParameters().get('id');
        insertCq();
        cqObj.RFQ__c = ApexPages.currentPage().getParameters().get('id');

        rfqObj =  [SELECT Accepted__c, Accepted_Date__c, Access_Mezzanines__c, Air_Compressor_s_Existing__c, Air_Compressor_s_by_Others__c, Air_Compressor_s_by_Shick__c, Assigned_Date__c, Assigned_To__c, 
                  Assigned_To_Workflow_Field__c, Batching_Software__c, Batching_or_Controls_Notes__c, Closed__c, Closed_Date__c, Commission_Dollar_Amount__c, Commission_Percentage__c, Completed__c, 
                  Completed_Date__c, Controls_Completed__c, Controls_Completed_Date__c, Controls_Completed_Percentage__c, Controls_Step_Weight__c, CreatedById, CreatedDate, 
                  Creation_of_Quote_Document_Completed__c, Current_Revision__c, DaysOnHold__c, Decline_RFQ__c, Declined_RFQ_Date__c, Declined_RFQ_Fixed__c, 
                  Declined_RFQ_Reason__c, IsDeleted, Dense_Phase_Pressure__c, Dense_Phase_Vacuum__c, Dilute_Phase_Pressure__c, Dilute_Phase_Vacuum__c, Due_Date__c, Electrical_Controls__c, End_User__c, 
                  Existing_PLC__c, Existing_Shick_Controls__c, Existing_Start_Panel__c, Final_Flow_Drawing_Completed__c, Final_Flow_Drawing_Completed_Date__c, Final_Flow_Drawing_Completed_Percentage__c, 
                  Final_Flow_Drawing_Completed_Step_Weight__c, Final_Flow_Drawing_Required__c, Foundations_Concrete_Work__c, Freight_Included__c, HMI_Choices__c, HMI_Quantity__c, Heat_Tracing__c, 
                  Installation_Electrical__c, Installation_Mechanical__c, Installation_Required__c, Is_Assigned__c, LastActivityDate, LastModifiedById, LastModifiedDate, Original_Lead__c, Liquids_Completed__c, 
                  Liquids_Completed_Date__c, Liquids_Required_Completed_Percentage__c, Liquids_Step_Weight__c, Locked__c, Logix_PLC__c, Margin_Calculator_Completed__c, Margin_Calculator_Completed_Date__c, 
                  Margin_Calculator_Completed_Percentage__c, Margin_Calculator_Required__c, Margin_Calculator_Step_Weight__c, Mechanical_Dry__c, Mechanical_Liquids__c, Minor_Ingredient_Automation_Required__c, 
                  Minor_Ingredient_Completed_Date__c, Minor_Ingredients_Completed__c, Minors_Ingredient_Step_Completed_Per__c, Minors_Ingredient_Step_Weight__c, Motor_Starter_Enclosure__c, 
                  Motor_Starter_Enclosure_Quantity__c, New_PLC_Required__c, New_Start_Panel_Required__c, Noise_Level_dBa_Max__c, OffHold__c, OffHoldDate__c, Old_Quote_Number__c, 
                  OnHold__c, OnHoldDate__c, OwnerId, PE_Stamped_Drawings_Required__c, PEM_Travel_Dollars__c, PLC_Enclosure__c, ParametersCount__c, Pipe_Insulation__c, Pipe_Sheathing__c, 
                  Plant_Compressed_Air_Available__c, Preliminary_Flow_Drawing_Completed__c, Preliminary_Flow_Drawing_Completed_Perc__c, Preliminary_FlowDrawing_Completed_Date__c, 
                  Preliminary_Flow_Drawing_Required__c, Preliminary_Flow_Drawing_Step_Weight__c, Preliminary_Flow_Sent__c, Preliminary_Flow_Sent_Date__c, Previous_Shick_Project__c, Priority__c, 
                  Quantity_of_AIM_Batching_Units__c, Quote_Document_Completed_Percentage__c, Quote_Document_Required__c, Quote_Document_Step_Weight__c, Quote_Number__c, Quote_Number_for_Opportunity__c, 
                  Quote_Type__c, Quoting_Priority__c, RFQ_Completion_Percentage__c, RFQ_Complted_Salesman__c, Name, RFQ_PoO__c, RFQ_Received_from_Controls_Quoting__c, RFQ_Recv_from_Controls_Quoting_Date__c, 
                  RFQ_Sent_for_Controls_Quoting__c, RFQ_Sent_to_Controls_Quoting_Date__c, RFQ_Stage__c, Ready_to_Submit__c, ReceivedInstallBid__c, Id, RecordTypeId, Related_Opportunity__c, Remote_I_O_Enclosure__c, 
                  Remote_I_O_Enclosure_Quantity__c, Replicate_Past_Project_Specs__c, Report_Quote_Number_to_Opportunity__c, Representative__c, Requested_By__c, Revision_Completed_Date__c, 
                  Revision_Notes__c, Scale_s_Calibration__c, SentforInstallBid__c, Separate_Scale_Enclosure__c, Separate_Scale_Enclosure_Quantity__c, Start_Up_Services_Required__c, 
                  Steps_Required_for_Completion__c, Submitted_Date__c, Support_Structures__c, System_Commissioning__c, System_Eng_Travel_Dollars__c, SystemModstamp, Target_GM_Percentage__c, Unlock__c, 
                  Utilize_Existing_Equipment__c, Weight_of_Steps__c, Percentage__c, ProgressBarCompletion__c 
                  FROM RFQ__c WHERE Id =: ApexPages.CurrentPage().getParameters().get('id')];
    }

    //method to save the Parameter record
    public void saveParameter(){
        try{
            insert parObj;
                insertPar();
              isSuccess = true;
        }
        catch(Exception ex){
            Apexpages.addMessages(ex);
            isSuccess = false;
        }
    }
     
    private void insertPar(){
        parObj = new Parameters__c();
        isSuccess = false;
    }

	//method to save the Controls Quote Record
    public void saveControlsQuote(){
        try{
            insert cqObj;
            	insertCq();
            isSuccess = true;
        }
        catch(Exception ex){
            Apexpages.addMessages(ex);
                issuccess = false;
        }
    }
    private void insertCQ(){
        cqObj = new ControlsQuoting__c();
        isSuccess = false;
    }
    
/////=======================================================================================/////
/////======================================--Buttons--======================================/////
/////=======================================================================================/////
    
    //Unlock Button Method 
    public void Unlock(){
        if(rfqobj.Locked__c != False){
			rfqobj.Locked__c = False;            
        }
        if(rfqObj.Unlock__c != True){
            rfqObj.Unlock__c = True;
        }
        update rfqObj;
    }
    
    public void Save(){
        try{
            update rfqObj;
            isSuccess = true;
            system.debug('SAVE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'+rfqObj.Due_Date__c);
        }
        catch(Exception ex){
            Apexpages.addMessages(ex);
                issuccess = false;
        }
    }
    
    public void Submit(){
        try{
            update rfqObj;
            isSuccess = true;
        }
        catch(Exception ex){
            Apexpages.addMessages(ex);
                issuccess = false;
        }
    }
    
    public PageReference RefreshPage(){
        pageReference pr = new pageReference('/apex/RFQModalDesign?id=' + rfqObj.Id);
        pr.setRedirect(true);
        return pr; 
    }
}

I am just stumped. When I update the Due Date in the modal and click save, nothing happens. No changes are written to the record. I manually refresh the page and affirm that no changes have been written. If I select any other field in the Modal it updates the record when I click save on the Modal.

Any suggestions? Please let me know if something doesn't make sense...there is a lot of code that was truncated, I don't think I left anything vital out.

Thanks.
ConverseManConverseMan
Upon working more on this, it appears that having the input fields, such as Due_Date__c, in a different modal on the same page, is potentially the cause of the issue. Once I removed Due_Date__c from the other modal, it began functioning (and saving) as expected in the first modal. Anyone have a reasoning for this? 
Brianne Wilson 4Brianne Wilson 4
Hmmmmm this may sound like a stupid question, but just to knock these options out of the way....do you have any restrictive permissions on that field? Any workflows that update that field? Any defaults set somewhere for that field? 

I can't see anything right off the bat, so I'd first start with seeing if there's anything else built in the system that sets that field that may be competing with this code.  The only other thought I had is the modal is closing before that field is saved, but if Stage is working fine then that wouldn't be it. 
faww afawfaww afaw
I'm working for the carpet cleaning project in my local and hosted my project website on WordPress. I do Carpet cleaning Long Beach CA (https://ecocleandrycarpet.com/) to offer cleaning service.