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
divya sri 31divya sri 31 

i am working on a project where i have a button name payment if the user is login then only he can go to payment section or not he has to go to login page

Hi All 
Can any one help me with this 
i am working on a project
where i have one login page and home page , in home page i have button name payment  if the user is login then only he can go to payment section or not he has to go to login page .


 
Shalini RShalini R

Hi Divya,

Could you share me the snapshots for the UI, so can understand easily.

Are you using any VF page and Apex controller for your requirement or other oprtions ?

Regards

Shalini R

divya sri 31divya sri 31
HI Shalini
thanks for the rly 
yes i am using vf page  and controller .

 can u help me with this
Shalini RShalini R

Hi Divya,

1. Login page you can call one controller, in that controller add the below coding. 

Code:

public String uname{get;set;} // Call from VF 
public String password{get;set;} // Call from VF

public pagereference Payment_Button(){ // Method call from VF button
    PageReference pageRef = new PageReference('/apex/HomePage_Name');  // 
    if(uname == 'Testname' && password == 'TestPassword'){
       pageRef.setRedirect(true);
    }
    return pageRef;
}

2. Enter Valid UN ,PS and click 'Payment' Button from Vf page. If the valid login credential entered it will go to another page.

 

Regards

Shalini R

(Salesforce Developer)

divya sri 31divya sri 31
Hi ,
Shalini 
thank u so much for ur rly  
i will try .