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
URVASHIURVASHI 

Passing data from one vf page to another

Hi can anyone help.

i have 2 pages

firstpage

secondpage

the first page has a next button on which i call the second page

next button code:

PageReference newpage = new PageReference('/apex/secondpage');
            newpage.setRedirect(false);
              
              return newpage;  

 

 the second page has a previous button which calls back the first page.

previous button code:

PageReference newpage = new PageReference('/apex/firstpage');
            newpage.setRedirect(false);
              
              return newpage;  

 Now the problem i am facing is when i click on previous button.it again calls the page n i get the data in my drop down list 2 times instead of once.

like if my firstpage has a drop down list with dynamic values like a,b,c

when i click on previous i get a,b,c,a,b,c in drop down.

and i need to keep setRedirect false as i want default value of drop down to be the one(when i click on previous button),which the user had clicked while navigating from the first page to the second.Can some please help.

 

Please help

Thanks.

hitesh90hitesh90

can you share your full class code here?

URVASHIURVASHI

thanks for the reply.

its a very huge code.

N im sure when i post such huge code no one replies.

Did u get my problem?

 

hitesh90hitesh90

then put the Function through which your dropdown get filling.

URVASHIURVASHI

Actually i am calling the values from my webservice.

So when i click on the method...may be the webservice is called again and i get the  values 2 times

URVASHIURVASHI

public List<SelectOption> getItems() {
            List<SelectOption> options2 = new List<SelectOption>();
            sqlArray18.ArrayOfstring a= new sqlArray18.ArrayOfstring();  
        a1.BasicHttpBinding_IService1 stub = new a1.BasicHttpBinding_IService1();   
       
      a  = stub.Getdatabasename();
          
     String[] returnArray = a.string_x;
      System.debug('Result'+returnArray);
for(String s: returnArray)
{
    System.Debug('*****************' + s);
    options2.add(new SelectOption(s,s));
}
       
    return options2;

        
        }