Below you can find code for creating a single record in Account Object using
Visualforce page.
You can just copy and Paste below code in Visualforce page and controller
and your Visualforce
will be ready for insert a record in Account Object.
Visualforce Page :-
ScreenShot :-
Controller Code :-
Visualforce Page :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <apex:page controller="insertRecord"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!saveinfo}" value="Save"/> </apex:pageBlockButtons> <apex:pageBlockSection > <apex:inputField value="{!accinsert.name}"/> <apex:inputField value="{!accinsert.phone}"/> <apex:inputField value="{!accinsert.type}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> |
ScreenShot :-
Controller Code :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public class insertRecord{ public account accinsert{get; set;} public insertRecord(){ accinsert= new Account(); } public void saveinfo() { insert accinsert; accinsert = new Account(); } } |
No comments:
Post a Comment