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
ankitha varraankitha varra 

Pagereference is not working in VF page

Vf page
<apex:selectList size="1" value="{!selResult}" >
<apex:selectOptions value="{! selOptions}" />
</apex:selectlist>
<apex:commandButton value="Go!" action="{!movingtoanotherpage}" />

controller

 Public pagereference movingtoanotherpage(){
     
    if(Selresult=='Create Account'){
    
    PageReference pageRef = new PageReference('/apex/YesBankAccountPage');
          Pageref.setredirect(true);
            return pageRef;
   }
    return null; 
  }
It is not showing any errors even though pagereference is not working
 
Manmohan SinghManmohan Singh
HI @ankitha varra,

Try below options
1. Add a system.debug inside movingtoanotherpage method to check the "selresult" value.
2. check if selOptions has 'Create Account' value.

Thanks
Manmohan
ankitha varraankitha varra
the value in the vf page is not assing to the controller