You need to sign in to do that
Don't have an account?
Salesforce Geevan
i have a vf page which has uswername and pwd field, i want to login to the employee and also the hr object from a single vf page with username and pwd
i have a vf page which has username and pwd field, i want to login to the employee object and also the hr object from a single vf page with username and pwd.
Below i created a login page for accessing Hr object,how can i access the Employee object using the same vf page.
Employee__c
Fields are: Username(Name),password( mobile__c)
MY VF page :
<apex:page showHeader="false" sidebar="false" controller="login" standardStylesheets="false">
<apex:form >
<style type ='text/css'>
.h{
margin-top:200px; }
</style>
<h>
<label>UserName </label>
<apex:inputText value="{!username}"/>
<br/>
<label>PassWord </label>
<apex:inputText value="{!password}"/><br/>
<br/>
<apex:commandButton value="Submit" action="{!Login}"/></h>
</apex:form>
</apex:page>
Apex class
public with sharing class login{
String username;
String password;
public String getusername() {return username;}
public void setusername(String un){this.username=un;}
public String getpassword() {return password;}
public void setpassword(String pw){this.password=pw;}
public pagereference Login(){
List<HR__c> a = [select id from HR__c where Name like:username and Mobile__c like:password ];
id idvar;
for(HR__c b : a)
{
idvar = b.id;
}
pagereference pgRef;
pgRef = new PageReference('https://ap2.salesforce.com/' + idvar +'/e?');
pgRef.setredirect(true);
return pgRef;
}
}
Below i created a login page for accessing Hr object,how can i access the Employee object using the same vf page.
Employee__c
Fields are: Username(Name),password( mobile__c)
MY VF page :
<apex:page showHeader="false" sidebar="false" controller="login" standardStylesheets="false">
<apex:form >
<style type ='text/css'>
.h{
margin-top:200px; }
</style>
<h>
<label>UserName </label>
<apex:inputText value="{!username}"/>
<br/>
<label>PassWord </label>
<apex:inputText value="{!password}"/><br/>
<br/>
<apex:commandButton value="Submit" action="{!Login}"/></h>
</apex:form>
</apex:page>
Apex class
public with sharing class login{
String username;
String password;
public String getusername() {return username;}
public void setusername(String un){this.username=un;}
public String getpassword() {return password;}
public void setpassword(String pw){this.password=pw;}
public pagereference Login(){
List<HR__c> a = [select id from HR__c where Name like:username and Mobile__c like:password ];
id idvar;
for(HR__c b : a)
{
idvar = b.id;
}
pagereference pgRef;
pgRef = new PageReference('https://ap2.salesforce.com/' + idvar +'/e?');
pgRef.setredirect(true);
return pgRef;
}
}