+ Start a Discussion
Raj R.Raj R. 

How would I create a visualforce page that is a form that save form fields into a custom object?


I have a custom object called customObj__c. I need to create a visualforce page that looks like this:

First Name : <textbox input>
Last Name : <textbox input>
Email: <textbox input>
<submitButton Here>

When the Submit button is pressed, i need to simply create a new customObj__c record using the values entered in the form (first name, last name, email). How to do I accomplish this? I am confused as to how I can use a class to save the new record on Submit button click.
Best Answer chosen by Raj R.
William LópezWilliam López
Hello rRup,

Here is a good example of a VF page and a controller:


But if you have a custom object with some fields, you can use the starndard page layout and the starndard edit page to save this information, there is not need to add custom code if you just want to save some basic data, usually a visual force page + controller its when you have a custom page with some expecial requeriments. 

Here is a video (kind of old but its shows the basic) about how to create a custom object and use the pagelayout to insert data:


I hope this helps.