I have a command button where the action is a controller method. I am getting a visual force error Formula Expression is required on the action attributes.

I did some looking up and this requires AJAX. How would I get this to work?

Command Button:

<apex:commandButton action="{!resetPassword}" value="Reset Password" id="theButton" oncomplete="changePassword()"/>

Controller Method:

public String resetPassword() {
    return 'test';

2 Answers 2


Your controller method has a return type of String, but in order to be a valid target of a page action, the return type needs to be either void or PageReference


Short answer is:

public String test { get; set; }     
public PageReference resetPassword() {
            this.test = 'test';
            return null;

You must log in to answer this question.

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