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
Akhil Mirthipati 2Akhil Mirthipati 2 

Create a Visual force page that should display Account Name, Phone and Industry fields of Account. There should be a Save button on the page. After filling the values in fields and clicking on save, the account should get saved

Akshay_DhimanAkshay_Dhiman
Hi Akhil,
Below is the solution of your question: 
<apex:page showHeader="true"  standardController="Account">
   <apex:form >
   <apex:pageBlock title="Account Update">
       <apex:pageBlockSection title="Account Details">
           <apex:inputField value="{!account.Name}"/>
          <apex:inputField value="{!account.Phone}"/>
          <apex:inputField value="{!account.Industry}"/>
       </apex:pageBlockSection>
       <apex:commandButton value="Save" action="{!save}"/>
   </apex:pageBlock>
   </apex:form>
</apex:page>
Hope this might help you.
Regards,
Akshay
Akhil Mirthipati 2Akhil Mirthipati 2
thanks akshay pls give me ur mail id i want to talk with u its very urgent.... pls
Amit Singh 1Amit Singh 1
Hello Akhil,

Use below code for VF Page.
<apex:page standardController="Account">
  <!-- Begin Default Content REMOVE THIS -->
  <apex:slds />
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection>
              <apex:inputfield value="{!Account.Name}"/>
              <apex:inputfield value="{!Account.Phone}"/>
              <apex:inputfield value="{!Account.Industry}"/>
              <!-- <apex:inputfield value="{!Account.EID__c}"/> -->
          </apex:pageBlockSection>
          <apex:pageblockButtons >
              <apex:commandButton value="Save Account" action="{!Save}"/>
          </apex:pageblockButtons>
      </apex:pageBlock>
  </apex:form>
  <!-- End Default Content REMOVE THIS -->
</apex:page>

Let me know the outcome.
Thanks,
Amit Singh
Shiva RajendranShiva Rajendran
Hi Akhil,
If you need to complete this request using custom controller for the same functionality ,use this code
VF Page
<apex:page showHeader="true"  Controller="AccountController_CC">
   <apex:form >
  <apex:pageBlock title="Account Update">
      <apex:pageBlockSection title="Account Details">
<apex:inputField value="{!acc.Name}"/>
        <apex:inputField value="{!acc.Phone}"/>
          <apex:inputField value="{!acc.Industry}"/>
      </apex:pageBlockSection>
       <apex:commandButton value="Save" action="{!saveRecord}"/>
   </apex:pageBlock>
   </apex:form>
</apex:page>

Controller :
class AccountController_CC
{
     public Account acc{get;set;}
   public AccountController_CC()
    {
         acc=new Account();
    }

     public void saveRecord()
      {
             insert acc;
      }


}

you can send me an email for any further details at shivarv1993@gmail.com .

Thanks and Regards,
Shiva RV
Shiva RajendranShiva Rajendran
Hi Akhil,
If you need to complete this request using custom controller for the same functionality ,use this code
VF Page
<apex:page showHeader="true"  Controller="AccountController_CC">
   <apex:form >
  <apex:pageBlock title="Account Update">
      <apex:pageBlockSection title="Account Details">
<apex:inputField value="{!acc.Name}"/>
        <apex:inputField value="{!acc.Phone}"/>
          <apex:inputField value="{!acc.Industry}"/>
      </apex:pageBlockSection>
       <apex:commandButton value="Save" action="{!saveRecord}"/>
   </apex:pageBlock>
   </apex:form>
</apex:page>



Controller :
class AccountController_CC
{
     public Account acc{get;set;}
   public AccountController_CC()
    {
         acc=new Account();
    }

     public void saveRecord()
      {
             insert acc;
      }


}


you can send me an email for any further details at shivarv1993@gmail.com .

Thanks and Regards,
Shiva RV
WaqarAhmedWaqarAhmed

VisualForce page

<apex:page controller="controllerAccount">
    <apex:form>
       
        <apex:pageBlock>
            <apex:pageBlockSection>
                 <apex:inputText value="{!Myacc.Name}"/>
                <apex:inputField value="{!Myacc.Phone}"/>
                <apex:inputField value="{!Myacc.Website}"/>
            	<apex:inputField value="{!Myacc.Ownership}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock >
            <apex:pageBlockButtons location="Bottom">
                <apex:commandButton action="{!showDebug}" value="Debug"/>
            </apex:pageBlockButtons>
            
        </apex:pageBlock>
	</apex:form>
</apex:page>


Controller

public class controllerAccount { 
    
    public Account Myacc{get;set;} 
                
    public controllerAccount()
    {
        Myacc=new Account();
    }
    
    public void showDebug(){
        System.debug('your info is '+Myacc);
        
    }
}