function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gaby FrydmanGaby Frydman 

VisualForce page becomes read only after validation rule conflict

Hi all, 

I am meeting some interesting challenges which I can't seem to figure out:

I have a site which is running a visualforce page that collects customer details. Customers can log in with their Customer Number and Date of Birth before being taken to completing a form of fields.

Problem is that when a conflict with validation rules occures, the page becomes read-only and the customer needs to refresh the page and no changes would be saved.

Any workarounds?
bob_buzzardbob_buzzard
So this is a custom, Visualforce page that loses its form in the event that there was a validation error?  To be honest that sounds like you are redirecting the user to another page regardless of the result of the save.
Gaby FrydmanGaby Frydman

The issue was in the controller:

I added the following to my try clause 

catch (DMLException e) {
            editContact.Id = null;
            ApexPages.Message msg = new ApexPages.Message(Apexpages.Severity.ERROR, e.getdmlMessage(0) );
            ApexPages.addMessage(msg);
        }
as opposed to 

catch (Exception e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
                    }

Hope that helps anyone else