what is the best practice to call two controller method from a single commandbutton click. I have a requirement that on single buttonclick, page will navigate to first page and also call add new method. currently commandbutton calls only one controller method AddMore
<apex:commandButton value="Add New" action="{!AddMore}" onclick="this.value = 'Adding...'" id="AddMoreButton" />
Method 1 -
public void AddMore()
{
//count = count+1;
Abv_Core_KAM_Competitor_Sales__c newRec=new Abv_Core_KAM_Competitor_Sales__c (Abv_Core_KAM_Account__c =Acc_Id);
if(records.size()>0)
{
records.add(0,newRec);}
else
{
records.add(newRec);}
}
Method 2 -
public boolean getprev()
{
if(index == 0)
return true;
else
return false;
}
that also need to be called from same commandbutton
getPrev()
method in yourAddMore()
method itself?