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
chiranjib routchiranjib rout 

Page redirection from one VF page to another VF page is not working.

here when i will give any jobid which is available in interview object then after pressing the enter button 1 new page(Feedback_JobID) will open and if the jobid is not available inside the interview object then 1 error message will come. But whenever i am trying to do that here for every value it is showing the error message.The flow is not going to if loop i think. Can anybody give me the idea what is wrong here..
VF Page:
<apex:page controller="Client_Feedback" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:Pagemessages id="msg"/>
<apex:form >
<CENTER><apex:image url="{!$Resource.LOGO}" width="200" height="130"/></CENTER>
<CENTER><p><b>Client Login Page</b><br /></p></CENTER>
<CENTER>
<apex:panelGrid columns="3" style="margin-top:1em;">
<p><b>JOB ID:</b><br />
<apex:inputText required="true" id="ID" value="{!var}"/>

<apex:commandButton action="{!search}" value="enter" id="enter"/>
  </p> 
</apex:panelGrid>
</CENTER>
</apex:form>
</apex:page>
 
CONTROLLER:
public class Client_Feedback {        
        public String ID {get;set;}
        public string var{set;get;}
        public List < SCSCHAMPS__Interview__c > intList {get;set;}
        //public Freelancer__c fre {get;set;}
        public PageReference search()
         {
            {
                
                //this.intList.clear();
                List<SCSCHAMPS__Interview__c> intList = [SELECT id,SCSCHAMPS__Job__c
                                                     FROM SCSCHAMPS__Interview__c 
                                                     WHERE SCSCHAMPS__Job__c= :ID  limit 1 ]; 
                 pageReference ref;                                    
                 if(!intList.isEmpty()) 
                 { 
                     
                     ref= page.Feedback_JobID;
                    ref.setRedirect(true);
                    return ref;
                  
                 }
                 else {
                   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .')); 
                    
                }
                return null;
                 
                 }                                               
            }
        }

 
Harish RamachandruniHarish Ramachandruni
Hi,

 
public class Client_Feedback {        
        public String ID {get;set;}
        public string var{set;get;}
        public List < SCSCHAMPS__Interview__c > intList {get;set;}
        //public Freelancer__c fre {get;set;}
        public PageReference search()
         {
            {
                
                //this.intList.clear();
                List<SCSCHAMPS__Interview__c> intList = [SELECT id,SCSCHAMPS__Job__c
                                                     FROM SCSCHAMPS__Interview__c 
                                                     WHERE SCSCHAMPS__Job__c= :ID  limit 1 ]; 
                 pageReference ref;  
                                  
                 if(!intList.isEmpty()) 
                 { 
                     
                     ref= page.Feedback_JobID;
                    ref.setRedirect(true);
                    return ref;
                  
                 }
                 else {
                   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .')); 
                    
                }
                return ref ;
                 
                 }                                               
            }
        }


Update this code .


Regards ,
Harish.R
 
chiranjib routchiranjib rout
hii Harish your code is same as  given code  ,the code is redirecting to the Feedback_JobID page but the problem is when i put any valid value in Job ID it have to redirect to Feedback_JobID  but what ever (random ) value i put in the Job ID it redirects now .so please suggest me
Harish RamachandruniHarish Ramachandruni

Hi,

Update this code 

 
public class Client_Feedback {        
        public String ID {get;set;}
        public string var{set;get;}
        public List < SCSCHAMPS__Interview__c > intList {get;set;}
        //public Freelancer__c fre {get;set;}
        public PageReference search()
         {
           
                
                //this.intList.clear();
                List<SCSCHAMPS__Interview__c> intList = [SELECT id,SCSCHAMPS__Job__c
                                                     FROM SCSCHAMPS__Interview__c 
                                                     WHERE SCSCHAMPS__Job__c= :ID  limit 1 ]; 
                 pageReference ref;  
                                  
                 if(!intList.isEmpty()) 
                 { 
                     
                     ref= page.Feedback_JobID;
                    ref.setRedirect(true);
                    return ref;
                  
                 }
                 else {
                   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .'));

 
                  return null ;    
                }
                 
                                                               
            }
        }


this is refrence code check this .if any issue ask me imediatly .
 
 
public PageReference redirect(){
        if(p == null){
            PageReference pageRef = new PageReference('/apex/demo2');
            return pageRef;
        }
        else{
            return null;
        }
}

Regards,
Harish.R.
Harish RamachandruniHarish Ramachandruni
Hi ,


is it solved my code .

Regards ,
Harish.R
chiranjib routchiranjib rout
hii harish the code is not working so i have decided not to give page reference so i have modified the vf page so could u please help me on it here is my new question  https://developer.salesforce.com/forums/ForumsMain?id=9060G000000Xa6zQAC.please just check and suggest me
chiranjib routchiranjib rout
hii harish can i use there wrapper class???