0

I have a custom visualforce page with a standard controller and extension class. I have created my own save Function in which I need to first update the standard controller record that I am editing, then a couple of other things and return a custom page reference.

This line:

stdController.save();

Saves the record correctly when there are no validation rules. However when there is a validation rule that gets activated, I can see that it appears in the debug log but the class just moves on and does not return null OR update the apex:pageMessages on the VF page.

What do I need to do with this save to have it catch any error messages, write it to apex page messages and return null.

Been trying to get more info on standard controller saves but everyone seems to have a different solution and to make things better none have worked so far.

1

2 Answers 2

1

Are you wrapping standard controllers save method in try catch and adding page messages in catch block. Make sure that you are rerendering page messages on your save action. If this does not help can you post controller save method snippet?

0

As you are using standard controller save method not using Any DML operation i.e. insert or Update , so inorder to show validation error message on page you have to use apex:pageMessages Tag in VF page when you click on Save button then it will display error message on VF page with respective of any input field (Validation whatever you have written on fields)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .