Fix for [Formula Expression is required on the action attributes] error

Sometimes Salesforce throws error messages which might to confound. It isn't depend on your seniority level as developer. As well as it isn't your fault, but just a very misleading message. Today I got the following error when was working with VisualForce page:

Formula Expression is required on the action attributes

Hmm, I checked each expression, each button, a whole markup on the page. But found nothing. The markup was good. I double check the markup. And nothing was found again. So, I went deeper to Google and finally I found the answer. It was incredibly easy to find and very stupid from my side.

So, there is an answer. You know that when you construct PageReference you have to do it in the following manner

PageReference nextPage = new PageReference('/apex/MyCoolVisualForcePage');

But I made stupidly mistake in such simple place

PageReference nextPage = new PageReference('MyCoolVisualForcePage');

It was fine for Salesforce on compilation level. But in runtime it crashed. Also you will find this error around if write in the such manner

PageReference nextPage = new PageReference('apex/MyCoolVisualForcePage');

So, leading backslash is required in PageReference constructor and if you miss it Salesforce will punish you by really strange error message.

[apex][errors][exceptions][salesforce errors][visualforce]