You need to sign in to do that
Don't have an account?
Save and New Button
Hi Friends,
I am unable to write code for save and new button on VF page. When I tried saving a record I got Error Message as follows
System.NullPointerException: Attempt to de-reference a null object
Class.familyController.saveandnew: line 18, column 1
--------------------------------------------------------------------------
Please help me
The controller I tried is as follows:
public with sharing class familyController {
public familyController(ApexPages.StandardController controller) {
}
public Family__c family{get;set;}
List<Family__c> rec;
public familyController(){
rec = new List<Family__c>();
}
public PageReference save(){
return null;
}
public PageReference saveandnew(){
try{
//family = new Family__c();
update family;
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
return (new ApexPages.StandardController(new Family__c())).edit();
/* public PageReference cancel(){
return null;
} */
}
}
Thanks In advance -----
Put this null check before following DML Update operation and check if it works?
update family;
Regards,