• jhons dake
  • 0 Points
  • Member since 2023

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
I am trying to build a login screen with VF, it has 2 text boxes and a command button. The value entered in th text boxes are setting the value of userid and password properties in my controll class. I have a method define in control class that will return true/false based on the credential. Below is the VF page
<apex:page controller="apxLoginCheck" showHeader="false" sidebar="false">
    <apex:form id="frmLogin">
        <apex:pageBlock title="Enter User details" id="pbLogin">
            <apex:pageBlockSection id="pbc">
                <apex:inputText id="txtID" value="{!UID}"/>
                <apex:inputText id="txtPWD" value="{!PWD}"/>
                <apex:commandButton id="btnOk" value="Click to Login" action="{!UserDetails}"/>

Below is the Controller
public class apxLoginCheck {
    public String UID{get;  set;}
    public string PWD{get;  set;}
    public apxLoginCheck(){

    public boolean UserDetails(){
        string newID ='ashish.biswas';
        string newPWD = 'ayushi@23';
        System.debug('B4 conditional check');
        if(UID==newID && PWD==newPWD){
            return true;
            System.debug('Method has been called');
        return false;
Can anyone please guide me, how shall I catch the boolean return value in VF on click of command button and call a JS function accordingly.

Thanks in advance