+ Start a Discussion
jagdish nikamjagdish nikam 

Custom controller extension

Please find below code:
public class MyController {
        private final Account account;
               public MyController() {
                   account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
               }
        public Account getAccount() {
               return account;
        }
        
        public PageReference save() {
               update account;
               return null;
        }
   }

In above example is it possible to change the method name "save"?  I am new to the visualforce. Any help would be really appreciable.

Thank you..
Best Answer chosen by jagdish nikam
sandeep madhavsandeep madhav

Hi,
Hope this helps,
You cant change the name directly in VF Page.

1.First remove the name "save" from VF page and save the page.
2.Change the name in Class then VF Page.
 

All Answers

{!Piyush_soni__c}{!Piyush_soni__c}
hi jagdish nikam
yes in the custom controller you can change the name of the method
i hop its helps you
Thanks
Mark it best answer if it helps you :)
Preya VaishnaviPreya Vaishnavi
Yep,it is possible.Change the method name "save" and also change the same name in visualforce page(where this save method is called) using this controller 
Aniket Malvankar 10Aniket Malvankar 10
Dear Jagdish,

yes, it is possible to change.

Thanks
Aniket
sandeep madhavsandeep madhav

Hi,
Hope this helps,
You cant change the name directly in VF Page.

1.First remove the name "save" from VF page and save the page.
2.Change the name in Class then VF Page.
 

This was selected as the best answer