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
Shwetal DesaiShwetal Desai 

How can i fetch Id from SelectList component??

here is my code:
-----------------------------------------------------------------------------------------------------------------------
String Emps;

public String selectedEmp {get;set;}

public List EmpList;

public List getEmployees()
{
try
{
if (EmpList== null)
{
Employee__c[] emp = [select Id,Name,Employee__c,FirstName__c,Last_Name__c from Employee__c where Active__c=true ORDER BY Employee__c];
EmpList = new List();
for(Employee__c empl : emp)
{
EmpList.add(new SelectOption(empl.Id, String.valueOf(empl.Employee__c)));
}
}
return EmpList;
}
catch(Exception ex){return EmpList;}
}
public String getEmps()
{
return Emps;
}
public void setEmps(String Emps)
{
this.Emps = Emps;
}
------------------------------------------------------------------------------------------------------
Now in other function i want selected Employee's Id..
But How can i take that??
That function is :
--------------------------------------------------------------------------------------------------------------------
public PageReference saveTc()
{
Employee__c emps = [select Id,Name,Employee__c,Password__c from Employee__c where Id=:Emps];
if(emps.Password__c == psw)
{
tc.EmployeeId__c = Emps;
tc.DateTime__c = DateTime.Now();
tc.CheckIn__c = DateTime.Now();
insert tc;
}
else
{
ApexPages.Message msg= new ApexPages.Message(ApexPages.Severity.ERROR, 'Invalid Password !', 'Invalid Password !');
ApexPages.addmessage(msg);
}
return null;
}
----------------------------------------------------------------------------------------------------------------------


please help.
jeffdonthemicjeffdonthemic
Shwetal,

Take a look at the blog post below. I use 3 picklists in the Visualforce page that are referenced in the controller extension. This should help.

http://blog.jeffdouglas.com/2008/11/25/dependent-multilevel-selectlists/

Jeff Douglas
Informa Plc
blog.jeffdouglas.com

Shwetal DesaiShwetal Desai
Done...

Thanks a lot for the help