+ Start a Discussion
Atla MasthanaiahAtla Masthanaiah 

Insert a record

 I have one object like Patient__c. This object contain some fileds.And create one VF tab Patient. Using this object to create a vf page and create some buttons like save and edit nad delete. But I am create a vf page but did not work whith save ,edit,delete buttons how to achive it.

<apex:page standardcontroller="Patient__c" sidebar="false">
    <apex:form >
            <apex:tab label="Patient">           
    <apex:pageBlock title="patien page">
        <apex:pageBlockSection >
        <apex:inputField value="{!Patient__c.name}"/>
         <apex:inputField value="{!Patient__c.Address__c}"/>
        <apex:inputField value="{!Patient__c.Age__c}"/>
         <apex:inputField value="{!Patient__c.City__c}"/>
        <apex:inputField value="{!Patient__c.DateTime__c}"/>
         <apex:inputField value="{!Patient__c.Gmail__c}"/>
        <apex:inputField value="{!Patient__c.Phone__c}"/>
         <apex:inputField value="{!Patient__c.RegNumber__c}"/>
                <apex:commandButton value="save" action="{!save}"/>
         <apex:commandButton value="Edit" action="{!Edit}"/>
          <apex:commandButton value="Exit" action="{!delete}"/>

siddik s 6siddik s 6
please give controller coding
Amit Singh 1Amit Singh 1
HI Atla,

This is salesforce Standard functionality which provides some by default actions like save, edit, delete and update.

If you do not want to perform any custom logic and wanted to achieve save, edit and save then you do not not need any controller code. It will work by default.

Muzammil BajariaMuzammil Bajaria
Hi Amit,Just curiously want to know that if we are doing operations on custom objects, then do we  need to write controller code to save,update or delete record? if not, then how does salesforce know on which object or field we are performing actions on.?
Amit Singh 1Amit Singh 1
Hello, you just need yo place standardcontroller="Your Custom Object" in your VF page that you're already doing.

The standard controller attribute will tell in which action need to be performed. And those fields will be included that are present in VF page.

Anit Singh