Im not able to save the standard object account using Extensions by over-riding the SAVE method
Help me out guys
Thnks in advance
I'm getting this Error :
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Account Name]: [Account Name] Error is in expression '{!savenow}' in component in page samplepage: Class.sampleExtension.savenow: line 19, column 1
Class.sampleExtension.savenow: line 19, column 1
Extension ::
public with sharing class sampleExtension {
public String Type{get;set;}
public String Name{get;set;}
public String Region{get;set;}
public account acc = new account();
public sampleExtension(ApexPages.StandardController controller) {
}
public PageReference savenow() {
acc.Name = Name;
acc.Type= Type;
acc.Region__c= Region;
system.debug('name' + acc.name + 'Type' + acc.Type + 'Region' + acc.Region__c );
insert acc;
System.debug('nickName: '+Type);
return null;
}
}
VF Page ::
<apex:page standardController="Account" extensions="sampleExtension" >
<p/>
<apex:form >
<apex:inputField value="{!account.Name}"/> <p/>
<apex:inputField value="{!account.Type}"/> <p/>
<apex:inputField value="{!account.Region__c}"/> <p/>
<apex:commandButton value="Save" action="{!savenow}"/>
</apex:form>
Name
to your account?