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
Matt FolgerMatt Folger 

Visualforce Error Help for this Page Formula Expression is required on the action attributes.

Trying to create a custom button in VF page that grabs a field value and then subtracts 1 from the presently queried record.  Having trouble.  I can built a button with the underlying code that renders the button but when I click it I get the error of this thread post:

"Visualforce Error Help for this Page  Formula Expression is required on the action attributes."  

I presume this is due to how it's calling the record, but don't know what to change.
 
<apex:commandbutton value="Return to Prev Dept" action="{!RPP_Tracker__c.Present_Dept_Number__c - 1}" />
Probably a syntax error, what am I doing wrong?
 
Best Answer chosen by Matt Folger
Matt FolgerMatt Folger
Anyone have any further tips?

All Answers

ClintLeeClintLee
Hi Matt,

The action of a commandbutton needs to correlate to a method on your controller.  For example, if your controller has a method named subtractOne() then you would do the following:
 
<apex:commandbutton value="Return to Prev Dept" action="{!subtractOne}" />

Do you want to subtract 1 and then update the Present_Dept_Number__c field with the new value?

Can you post your VF page and controller code?

Clint
 
Matt FolgerMatt Folger
Anyone have any further tips?
This was selected as the best answer