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
sreejasreeja 

how to save in the database with customobject

<apex:page standardController="Companies__c" sidebar="false">

  <apex:sectionHeader title="Company Information" help="Help for this page" />
  <apex:form >
  
     <apex:pageBlock title=" cmp Information" tabStyle="Account" >
         
         
           
             <apex:pageBlockButtons > 
                       <apex:commandButton value=" Save " action="{!save}" />
                      <apex:commandButton value=" Cancel " action="{!cancel}" />
               
               
              </apex:pageBlockButtons>
       
              
      
           <apex:pageBlockSection columns="2" >
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company Name" />
                    <apex:inputfield value="{!Companies__c.name}" /> 
                </apex:pageBlockSectionItem>
                
                
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company phone" />
                    <apex:inputText value="{!Companies__c.cmpanies_phone__c}" /> 
                </apex:pageBlockSectionItem>
                
                
          
               
            
                  
          
             
                 
                 
                
               
                 
          
           
               
               
                 
           </apex:pageBlockSection>
                  
                  
                  
                      <!--contact Information-->
                      
                      
                        <apex:pageBlockSection columns="2" title="Contact Information">
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact Person"/>
                    <apex:inputfield value="{!Companies__c.Contact_Person__c}" /> 
                </apex:pageBlockSectionItem>
                
                
             
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact's Email Address" />
                    <apex:inputText value="{!Companies__c.Contact_s_Email_Address__c}" /> 
                </apex:pageBlockSectionItem>
          
               
              
     
               
                 
           </apex:pageBlockSection>
                  
                  
            
           
        
   
           
        
        
       
     
     </apex:pageBlock>
  
  </apex:form>
  
</apex:page>
  i had created a  custom filed and a custom object and i had created a visualforce page, if  i had saved the record ,it is not getting save , may i know the error in that???
Mohd  RaisMohd Rais
Hi ramyasree,
Please copy and paste below code It's working fine.
<apex:page StandardController = "Companies__c" sidebar="false">
    
    <apex:sectionHeader title="Company Information" help="Help for this page" />
    <apex:form >
        <apex:pageBlock title=" cmp Information" tabStyle="Account" >
            <apex:pageBlockButtons > 
                <apex:commandButton value=" Save " action="{!save}" />
                <apex:commandButton value=" Cancel " action="{!cancel}" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2" >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company Name" />
                    <apex:inputfield value="{!Companies__c.Name}" /> 
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company phone" />
                    <apex:inputText value="{!Companies__c.Companies_phone__c}" /> 
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <!--contact Information-->
            <apex:pageBlockSection columns="2" title="Contact Information">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact Person"/>
                    <apex:inputfield value="{!Companies__c.Contact_Person__c}" /> 
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact's Email Address" />
                    <apex:inputText value="{!Companies__c.Contact_s_Email_Address__c}" /> 
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

If you understand this Please give the best answer.
Thanks
Mohd Rais
TruptiTrupti
Hi Ramyashree,

Your code looks good.There is no bug in the code.
Are you getting any error??

Thanks
sreejasreeja
hi i had made the mistake in the filedname, thanks for you support @Trupti, and Mohd,  happy to meet you . 
thanks and regards
ramya