Code:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page Controller="ContactController" > | |
<apex:form > | |
<apex:pageBlock title="Edit Contact"> | |
<apex:pageBlockSection columns="1"> | |
<apex:inputField value="{!c.FirstName}"/> | |
<apex:inputField value="{!c.LastName}"/> | |
<apex:inputField value="{!c.Email}"/> | |
<apex:inputField value="{!c.Birthdate}"/> | |
</apex:pageBlockSection> | |
<apex:pageBlockButtons > | |
<apex:commandButton action="{!save}" value="Save"/> | |
</apex:pageBlockButtons> | |
<apex:pageBlockTable value="{!samepage}" var="c"> | |
<apex:column headerValue="First Name"> | |
<apex:outputField value="{!c.Firstname}"/> | |
</apex:column> | |
<apex:column headerValue="Last Name"> | |
<apex:outputField value="{!c.Lastname}"/> | |
</apex:column> | |
<apex:column headerValue="Birthdate"> | |
<apex:outputField value="{!c.Birthdate}"/> | |
</apex:column> | |
</apex:pageBlockTable> | |
</apex:pageBlock> | |
</apex:form> | |
</apex:page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class ContactController { | |
public Contact c { get; set; } | |
public List<Contact> samepage { get; set; } | |
public ContactController(){ | |
c=new Contact(); | |
} | |
public PageReference save() { | |
insert c; | |
samepage= [select id,FirstName,LastName,Email,Birthdate from Contact where id=:c.id]; | |
return null; | |
} | |
} |
No comments:
Post a Comment