+ Start a Discussion
vijayabhaskarareddyvijayabhaskarareddy 

action function not working

when we click on command button   first execute  NoOfPassengersTrueFalse()  if  it return true show elert message "TRUE"
if it returns false  call  QuoteAcceptedITpage() method 


 
JS
=====

function NoOfPassTrueFalse(PassengersTrueFalse)
    {
          var pass= PassengersTrueFalse;
          
          if(pass==true)
          {
          
          alert('true')

      
           }
           else{
                     
           callApexMethod();
          }
           
           
      } 
============================================================	  
	  
	<apex:commandlink     action="{!NoOfPassengersTrueFalse}"  value="Accept"  oncomplete=" NoOfPassTrueFalse('{! PassengersTrueFalse}');"/>
	 <apex:actionFunction name="callApexMethod"  action="{!QuoteAcceptedITpage}"  />
	 =============================================================================
	 
	 
	  public boolean NoOfPassengersTrueFalse()
    
     {
       
       AddPassengerController obj= new AddPassengerController();
        
        PassengersTrueFalse= obj.AddPassengerMethod();
        
        return PassengersTrueFalse;
       
      }
	  
	  
	  
	   public pageReference QuoteAcceptedITpage()
    
    {
      
       
        
       
         
         Id orderID=Apexpages.currentpage().getParameters().get('orderId');
         Order ord= new Order();
         ord.Id=orderID;
         ord.Order_Stage__c='Quote';
         ord.Admin_Stage__c='Quote Accepted';
         update ord;
         
        
        pageReference pgRef = new pageReference('/apex/ItineraryDetailPage?Id='+itineraryID);
        pgRef.setRedirect(true); 
        
        return pgref;       
        }
	  ===========================================

 
Aslam ChaudharyAslam Chaudhary
What is your current result
It seems to me you are passing string and checking wiht true which is Boolean.
vijayabhaskarareddyvijayabhaskarareddy
showing error page  and  callApexMethod(); not calling the QuoteAcceptedITpage();
Aslam ChaudharyAslam Chaudhary
Change the return type of method NoOfPassengersTrueFalse to pagereference.