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
d.sureshkumar41.33978150573839d.sureshkumar41.33978150573839 

One vf page results shown in another page

Hi I have two vf pages

   1.searchfunctionalitypage

   2. layout page.

 

     In the first page i have picklist for selecting object , textbox for entering searchcharacters and  go button when we click on the go button i want hide the vfpages in another layoutpage and show the search results for the first page.

 

         the two vf pages use the same controller.

 

the first page code is

 

vfpage:(searchfunctionalitypage)

 

   <apex:page showHeader="false" controller="CLS_SearchFunction">
<apex:form >

<html>

<body>
 
<div class="online_serviceContainer">
        
          <div class="online_serviceBox">
            
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                 <!---    <tr>
                 <td colspan="3" class="title">Search</td>
                  </tr>  
                  <tr>
                    <td width="10%">&nbsp;</td>
                    <td width="70%">&nbsp;</td>
                    <td width="20%">&nbsp;</td>
                  </tr> --->
                  <tr>
                  <td>&nbsp;</td>
                  <td>
                    <apex:selectList value="{!selectedobj}" size="1" style="Width:160px">
                    
                          <apex:selectOption itemValue="Search All" itemLabel="Search All"/>
                    
                          <apex:selectOption itemValue="Case" itemLabel="Case"/>
                    
                          <apex:selectOption itemValue="Account" itemLabel="Account"/>
                    
                   </apex:selectList> <br/>
                   
                   <apex:inputtext value="{!searchtext}" style="Width:120px" /> <br/>
                   
                   <apex:commandButton value="Go!" action="{!searching}" />
               
                          
                    
                    </td>
                    <td>&nbsp;</td>
                    
                    
                    
                  </tr>  
                  
                  <tr>
                    <td style="height:110px;">&nbsp;</td>
                    <td style="height:110px;">&nbsp;</td>
                    <td style="height:110px;">&nbsp;</td>
                  </tr>
                </table>
                
          </div>
            
        </div>
  </body>
</html>  
</apex:form>
</apex:page>

 

 

the second vf page (layout page)

 

<apex:page showHeader="false" controller="CLS_SearchFunction" >
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"/>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<META HTTP-EQUIV="Expires" CONTENT="0"/>

<html>
  <body>
   <table width="100%" height="auto" border='0'>
    <tr>
      <td width='33%'><apex:iframe src="/apex/iTWOnlineServiceComponent" scrolling="false" id="theIframe1" height="300px" /></td>
      <td width='33%'><apex:iframe src="/apex/WhatsNew"  scrolling="false" id="theIframe2" height="300px" /></td>
      <td width='34%'><apex:iframe src="/apex/VF_SupportCenter"  scrolling="false" id="theIframe3" height="300px" /></td>
    </tr>
  </table>
 
  <table width="100%" height="auto" border='0'>
   <tr >
      <td ><apex:iframe src="/apex/VF_SearchFunctionality" scrolling="false" id="theIframe4" width="1050px" height="300px"/></td>
    <!---  <td ><apex:iframe src="/apex/VF_RecentItem" scrolling="false" id="theIframe5" height="300px"/></td> --->
   
   </tr>
   </table>
   
   <!---  <table width="100%" height="auto" border='0'>
   <tr>
      <td width='25%'><apex:iframe src="/apex/VF_SearchbuttonFunctionality" scrolling="false" id="theIframe6" height="320px" /></td>
   </tr>
   <td> </td>  
      
   </table> --->
   
  
 

</body>
</html>
</apex:page>

 

 

the class is

 

public class CLS_SearchFunction {

   
    public LIST<LIST<SObject>>  searchresults{get;set;}
    
    public list<Case> Cslst{get;set;}
    
    public list<Account> Acclst{get;set;}
           
    public string searchtext{ get ; set;}
    
    public string selectedobj{ get; set;}
                
    public string qry{get;set;}
    
    public boolean searchbl{get;set;}
    
    public static boolean searchbl1{get;set;}
    
    public CLS_SearchFunction()
    
    {
           searchresults = new LIST<LIST<SObject>>();  
                  
              Cslst         = new list<Case>();
                  
              Acclst        = new list<Account>();
       

    }
    
    
    public void searching() {
    
          
        
        
        
           searchresults.clear();
           
           system.debug('12345678'+searchresults.size());
           
           Cslst.clear();
           
           Acclst .clear();   
           
      if(searchtext.length() >= 2 )
                 
        {
           if(searchtext !=null && searchtext != '' )
           
           {
         
           qry = 'FIND \'' +searchtext+'*\' IN ALL FIELDS RETURNING Case(casenumber,subject,id),Account(name,ownerid,id)';
        
           searchresults=search.query(qry);  
           
           system.debug('12345'+searchresults);
           
           }
           
          if(searchresults.size() > 0)
              
          {
               
           Cslst   = searchresults[0];
           
           system.debug('12345cs'+Cslst   );
               
           Acclst  = searchresults[1];
                
          }
          
          if((selectedobj == 'Search All')  &&  (Cslst.size() == 0) && (Acclst.size() == 0))
               {
                       
                      apexpages.message acctmsg=new apexpages.message(apexpages.severity.info,'No records found meeting your criteria');
                                 
                      apexpages.addmessage(acctmsg);
                                 
                       system.debug('pppp'+acctmsg);           

              }
              
           else  if((selectedobj == 'Case')  &&  (Cslst.size() == 0))
               {
                       
                      apexpages.message acctmsg=new apexpages.message(apexpages.severity.info,'No Case records found meeting your criteria');
                                 
                      apexpages.addmessage(acctmsg);
                                 
                       system.debug('pppp'+acctmsg);           

              }
              
            else if ((selectedobj == 'Account') && (Acclst.size() == 0))
           
              {
           
                     apexpages.message acctmsg=new apexpages.message(apexpages.severity.info,'No Account records found meeting your criteria');
                                 
                      apexpages.addmessage(acctmsg);
                                 
                       system.debug('pppp'+acctmsg);         
              }
        
      }
      
       else
        
        {    
        
          apexpages.message acctmsg1=new apexpages.message(apexpages.severity.error,'search term must be Contains two characters');
                                 
          apexpages.addmessage(acctmsg1);
       }   

        
     /* Pagereference p= page.Vf_CustomerportalLayout;
        p.setredirect(false);
        return null; */
    }
    
    public PageReference back()
     {
      
       Pagereference pr= page.VF_SearchbuttonFunctionality;
        pr.setredirect(false);
        return pr;
    }  
        
       
 
}

 

  PLZ help me.Thnx in advance.