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

How to turn off error messages in visualforce?

I have a VisualForce page that has three functionalities,

Hence it has three 'public PageReference' subroutines,

That are called when an action happens in the page [i.e. button]


One of the functionalities requires user input [i.e. inputText],

So the main APEX code has a variable declaration for that input:


    public String UserInput { get; set; }


Since each task is not really related,

When I hit the button on the other two functionalities,

I get a VisualForce error, Because the inputText object has no user input,


How can I prevent that from happening,


Another way to solve this,

How do I turn off VisualForce Error messages?

So I can do error handling from APEX,

Looking at the debug log file,

The error is in VisualForce NOT APEX,



Best Answer chosen by Admin (Salesforce Developers) 



You can use an attribute of command button (immediate=true).



If this solves your problem then please mark it as solution. do not forget to give kudos.