+ Start a Discussion

hi all plz help me in this scenario

plz help me when i redirect my first visual force page to the second on button click go to list the second visual force page should automatically get the values of the doctor and branch so plz help me in this whr i should do it in my code






my first visual force page


<apex:page standardController="Appointment__c"  sidebar="false" showHeader="false"  >
<apex:form > 
Branch:<apex:inputField id="branch" value="{!Appointment__c.Branch__c}"/><br/>
Doctor:<apex:inputField id="doctor" value="{!Appointment__c.Doctor__c}"/><br/>

 <apex:commandButton value="GO" action="/apex/calander?br={!appointment__c.branch__c}&dr={!Appointment__c.Doctor__c}&brname={!appointment__c.BRANCH__R.NAME}"/>
<apex:commandButton value="GO to list" action="/apex/Dev_Doctor_Based_Appt?br={!appointment__c.branch__c}&dr={!Appointment__c.Doctor__c}"/> 


 now my second visual force page





<apex:page standardController="Appointment__c" extensions="Dev_Doctor_Based_ApptController" sidebar="false" tabStyle="Doctor_Appts__tab">

<apex:form >

  <table border='0' cellpadding='0' cellspacing='0'>
 <td width='400px'><b><apex:outputLink value="/apex/Dev_Doctor_Based_Appt">Doctor Appointments Static</apex:outputLink></b></td>
  <td width='60px'>
  <b>BRANCH</b>&nbsp;<apex:inputField value="{!userInputAppointment.Branch__c}"/><br/>
 <td width='60px'>
 <b>DATE</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputField value="{!userInputAppointment.Appt_Date__c}"/><br/>
  <td width='400px'><apex:outputLink value="/apex/Dev_Dyn_Doctor_Based_Appt">Doctor Appointments Dynamic</apex:outputLink></td>
  <td width='60px'>
  <b>DOCTOR</b>&nbsp;<apex:inputText id="searchText" value="{!searchText}"/><br/>
 <td width='60px'>
  <b>PATIENT</b>&nbsp;<apex:inputText id="searchText1" value="{!searchText1}"/><br/>
 <tr><td width='400px'><apex:outputLink value="/apex/Dev_Transaction_Based">Trans Appointments Static</apex:outputLink></td>
 <td width='200px' align ='center'>
<apex:commandButton value="GO" action="{!load}"/>

 <tr align='left'>
 <td width='400px'>
 <apex:outputLink value="/apex/Dev_Dyn_Transaction_Based">Trans Appointments Dynamic</apex:outputLink></td>
 <td width='200px'>

<apex:outputPanel rendered="{!IF((searchText1 !=null),true,false)}">
<apex:commandButton value="CHECK IN" action="{!checkin}"/>
<apex:commandButton value="CHECK OUT " action="{!checkout}"/>
<apex:commandButton value="CANCEL APPT" action="{!cancelled}"/>


controller for my second visual force page
public with sharing class Dev_Doctor_Based_ApptController {

    public Dev_Doctor_Based_ApptController(ApexPages.StandardController controller) {
    userInputAppointment = new Appointment__c();
  user u= [select id,name,Formula_Branch__c,branch__c  from user where id=:UserInfo.getUserId()];
   Branch__c[] b = [select id,name from branch__c where name =:u.Formula_Branch__c or name = null];
   if(u.Formula_Branch__c != null){
       userInputAppointment.Branch__c = b[0].id;
       searchText4  = 'NONE';

  public List<appointment__c> appointments {get;set;}  
  public List<appointment__c> appttimes {get;set;}  
  public List<staff__c> doctors {get;set;} 
  public Appointment__c userInputAppointment {get; set;}
  //Array to hold Doctors
  public String[] rtypes {get;set;}
 // Array to hold Appointment Times
  public String[] timekl {get;set;}
  public String[] timekl1 {get;set;}
  public user ux{get;set;}
  public string searchText  {get;set;}
  public string searchText1 {get;set;}
  public string searchText2 {get;set;}
  public string searchText3 {get;set;}
  public string searchText4 {get;set;}
  // start code changes 
  public String getname() {
    return 'Dev_Doctor_Based_ApptController';
// end code changes

 // public void load() {
         public PageReference load() {
        //Get all The doctors
         doctors =[select id,name from staff__c];
         ux= [select id,name,Formula_Branch__c,branch__c  from user where id=:UserInfo.getUserId()];
       //Get the Appointment Time slots
        appttimes =[Select appt_time__c,RecordType.Name,RecordType.id from appointment__c where RecordType.id ='01290000000YEi3'];
       // Get all Appontments for the Doctors

 appointments =[Select  id,
  // From appointment__c where (((branch__c = :userInputAppointment.branch__c and Appt_Date__c = :userInputAppointment.Appt_Date__c and RecordType.id !='01290000000YEi3')) and (doctor__r.name like:searchtext+'%' AND ACCOUNT__R.NAME LIKE:SEARCHTEXT1+'%' ))];     
//From appointment__c where (((branch__c = :userInputAppointment.branch__c and Appt_Date__c = :userInputAppointment.Appt_Date__c and RecordType.id !='01290000000YEi3')) and (doctor__r.name like:searchtext+'%' AND ACCOUNT__R.NAME LIKE:SEARCHTEXT1+'%'AND Recordtype.name LIKE:SEARCHTEXT2+'%'))];     
  //From appointment__c where ((((branch__c = :userInputAppointment.branch__c and Appt_Date__c = :userInputAppointment.Appt_Date__c and RecordType.id !='01290000000YEi3') and (doctor__r.name like:searchtext+'%' AND ACCOUNT__R.NAME LIKE:SEARCHTEXT1+'%') AND (Check_in__c =: userInputAppointment.Check_in__c AND Check_Out__c =: userInputAppointment.Check_Out__c AND Cancelled__c =: userInputAppointment.Cancelled__c))))]; 
 From appointment__c where (((branch__c = :userInputAppointment.branch__c and Appt_Date__c = :userInputAppointment.Appt_Date__c and RecordType.id !='01290000000YEi3')) and (doctor__r.name like:searchtext+'%' AND ACCOUNT__R.NAME LIKE:SEARCHTEXT1+'%'AND Recordtype.name LIKE:SEARCHTEXT2+'%' and Appt_status__c LIKE:SEARCHTEXT3+'%' and (NOT Recordtype.name LIKE:SEARCHTEXT4+'%')))];     
    // dynamically create set of unique Doctors from query
    Set<String> rtypeset = new Set<String>();
    for (appointment__c a : appointments)
   // dynamically create set of unique Appointment times from query
   Set<String> timeset = new Set<String>();
    for (appointment__c a : appttimes)
   //subhash on 18 may 
   Set<String> timeset1 = new Set<String>();
    for (appointment__c a : appointments)
    timekl1  = new String[timeset1.size()];
    Integer t = 0;
    for (String state1 : timeset1) { 
      timekl1[t] = state1;
   //stop subhash
    // convert the set into a string array  
    rtypes = new String[rtypeset.size()];
    Integer i = 0;
    for (String state : rtypeset) { 
      rtypes[i] = state;
    // convert the set into a string array  
   timekl  = new String[timeset.size()];
    Integer j = 0;
    for (String state1 : timeset) { 
      timekl[j] = state1;
    return null;
   //mass cancel the appts by filtered search
 public PageReference cancelled() {
 for(appointment__c app:appointments){
 if(searchText1 != null && app.Check_Out__c !=true && app.Check_In__c !=true){
 app.Cancelled__c = true;
 update appointments;
 return null;
  //mass chk out the appts by filtered search
 public PageReference checkout() {
 for(appointment__c app:appointments){
 if(searchText1 != null && app.Cancelled__c !=true && app.Check_In__c == true){
 app.Check_Out__c = true;
 update appointments;
 return null;
  //mass chk in the appts by filtered search
 public PageReference checkin() {
 for(appointment__c app:appointments){
 if(searchText1 != null && app.Cancelled__c !=true){
 app.Check_In__c = true;
 update appointments;

 return null;