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
HARSHIL U PARIKHHARSHIL U PARIKH 

Command Button {!QuickSave} Action throws an unknown method error

I am trying to refresh the visualforce page with
 <apex:commandButton value="Refresh Button" action="{!QuickSave}"/>
but it throws an error as unknown method. Can anyone please help on this?

I have also tried with 
<apex:commandButton value=" Refresh " onclick="URL"/>
but still not refreshing
Best Answer chosen by HARSHIL U PARIKH
HARSHIL U PARIKHHARSHIL U PARIKH
If anyone is still reviewing this post then the ANSWER IS BELOW. Well, it's someone else's solution.

We can write PageReference method and then clear the list.

Clear the account list.
For example if you are displaying Accounts from the list called 'AccountList'.
Then the refresh method looks like this

<apex:commandButton value=" Refresh " action="{!RefreshPage}" styleClass="buttonStyle" style="width:100px;"/>

Public PageReference RefreshPage() {
AccountList.clear();
return null;
}

All Answers

Prateek Singh SengarPrateek Singh Sengar
Hi Govind,
Can you share the QuickSave method from your controller or extension so that we can pin point the issue.
Deepak agarwal 9Deepak agarwal 9
Hi Govind,

You have written action={!QuickSave} as the component on vf page for that custom component to work you need to write a property in controller
Thats y it is showing that error.Mark as best answer to help others find it quickly.


public void Quicksave(){

// what it does..

}

Thanks,
Deepak Agarwal.
HARSHIL U PARIKHHARSHIL U PARIKH
Hi Prateek
Doesn't {!QuickSave} is standard library method so you can call it on your vf page?

Anyway, I have a search bar and once you search the name it appreas on search list. Now, if you reload the page from URL the search results goes away. I want same behaviour with "Refresh" button.
Prateek Singh SengarPrateek Singh Sengar
Hi Govind,
Quick save is not a standard method. Salesforce standard controller do have Save method. For complete list of standard methods please refer to
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_ApexPages_StandardController_methods.htm 

Hope this helps.
HARSHIL U PARIKHHARSHIL U PARIKH
Thank you for the information but is there anyway I can have button on VF page which can Refresh the page just like one can refresh the URL?
I appreciate your followup prateek..
Prateek Singh SengarPrateek Singh Sengar
Hi Govind,
You can try something like
 
<apex:commandLink value="click here to refresh" onclick="window.location.href='/apex/VFPageName" />
Replace the VFPageName with you VF page name
 
HARSHIL U PARIKHHARSHIL U PARIKH
Sorry though... not working
Prateek Singh SengarPrateek Singh Sengar
Hi Govin,
Please share your code for the refresh link. Did you made the changes as mentioned in my post?
HARSHIL U PARIKHHARSHIL U PARIKH
My old Code: 
<apex:commandButton value=" Refresh " action="{!RefreshPage}" styleClass="buttonStyle" style="width:100px;"/>

controller:
 Public PageReference RefreshPage(){
    return page.MerchandiseVFSearchBars;
    }

-----------------------------------------------------------------------------------------
New code:
<apex:commandLink value="click here to refresh" onclick="window.location.href='/apex/MerchandiseVFSearchBars" />
This link is not clickable for some reson...
so I tried to convert in button and it's clickable but acting same as old code
<apex:commandButton value="click here to refresh" onclick="window.location.href='/apex/MerchandiseVFSearchBars" />

 
Prateek Singh SengarPrateek Singh Sengar
you can try something like this for command button
 
<apex:page standardController="account">
<apex:form >
  
  <apex:commandButton value="click here to refresh" onclick="this.form.reset();return false;"/>
</apex:form>  
</apex:page>

please ensure that you commandbutton is wrapped inside an apex:form
HARSHIL U PARIKHHARSHIL U PARIKH
<apex:pageBlockButtons >
          
                <apex:commandButton value=" Refresh " action="{!RefreshPage}" styleClass="buttonStyle" style="width:100px;"/>
                  <apex:commandButton value="click here to refresh" onclick="this.form.reset();return false;"/>

                
                
                
            </apex:pageBlockButtons>

This pageblock button is under <apex:form> component.
When I click the "click here to refresh" button, it looks like the button is not clickable.
HARSHIL U PARIKHHARSHIL U PARIKH
And when I click the "Refresh" button what happens is that page gets reloaded but that reload is different than reloading page via URL.
HARSHIL U PARIKHHARSHIL U PARIKH
What I am trying to have is when I click the "Refresh" button, these search results (e.g., acme, inc.) should go away.User-added image
HARSHIL U PARIKHHARSHIL U PARIKH
If anyone is still reviewing this post then the ANSWER IS BELOW. Well, it's someone else's solution.

We can write PageReference method and then clear the list.

Clear the account list.
For example if you are displaying Accounts from the list called 'AccountList'.
Then the refresh method looks like this

<apex:commandButton value=" Refresh " action="{!RefreshPage}" styleClass="buttonStyle" style="width:100px;"/>

Public PageReference RefreshPage() {
AccountList.clear();
return null;
}
This was selected as the best answer