+ Start a Discussion

save functionality not working

Hi friends,


I am unable to save a record with the following code. Please help



public with sharing class personAccController {
ApexPages.StandardController con;

public personAccController(ApexPages.StandardController controller) {
con = controller;
public pagereference redirect(){
pagereference ref= new pagereference('/apex/personaccpage');
return ref;



---------------part of page----------------

<apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Save&New" action="{!redirect}"  />
            <apex:commandButton value="Cancel" action="{!Cancel}"/>


What behaviour are you seeing? You might want to look at adding an apex:pageMessages tag to your page if you don't already have one, as this will display any errors that occur when attempting the save.
I have written code for 'save and new' as redirect method. Unable to save the record, when attempted saving a record the page is reloaded with the record details entered. Save and new is working fine, facing problem with save

Have you added an apex:pageMessages tag to see if there are any validation errors etc?