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
Rick MacGuiganRick MacGuigan 

Save Visual Force components from main page

I have (5) Visual Force components on a main Visual Force page. How can I best save all component data and main page using a save button on the main page? Would appreciate guidance with code examples that others may have done. Many thanks.
Rick MacGuiganRick MacGuigan
This is the code I am trying . Just need to undersntand how to issue a save to the component's object from the main page controller.
 
//The main page object:        
       public Claims_Client_Risk_Assessment__c CCRA { get; set; }
//The components page object:        
       public CCRA_LOB_NonStdAuto__c LOB_NonStdAuto { get; set; }  

       this.CCRA = (Claims_Client_Risk_Assessment__c) controller.getRecord();
       this.LOB_NonStdAuto = new CCRA_LOB_NonStdAuto__c();  


        Public Void SaveTestInsert() {
            try {
                upsert CCRA;
                stdController.save();
                SFDCAttachLOB();
            } catch (Exception ex) {
                ApexPages.addMessages(ex);
            }
        }

        Public void AttachLOB() {
        try {
               LOB_NonStdAuto.Claims_Client_Risk_Assessment__c = CCRA.id;
               LOB_NonStdAuto.Name = CCRA.Name;
               Upsert LOB_NonStdAuto;    
            } catch (Exception ex) {
                ApexPages.addMessages(ex);
            }    
        }