+ Start a Discussion
The KnightThe Knight 

Not able to retrieve the values from the selectList into javascript

   Hi I am suppose  to instantiate sobject dynalically based on the selected parameter. Please suggest the solution based on the given scenario.

I am having two dependant <apex:selectlist> components.

   upon the selection of the value of the selectList1 the values in the second picklist are getting populated. Here I am using <apex:actionsupport> for rerendering the second selectList.

   Now I want to retrieve the selectlist values into javascript. I am able to retrieve the values of first picklist but not the second list since it is dynamically populated from ajax response.

   The reason I want to retrieve the values into javascript is I have to instantiate teh custom based on the selected values. This cannot be done using Apex controller. In apex we cannot instantiate objects dynamically based on the parameter like in ajax new sforce.SObject("Account");


Thanks in Advance




The KnightThe Knight
Forgot to mention one more point in the above post. I tried using global class. In controller I am calling the static setter method of global class. and calling the static getter method of the global class from the javascript. But I found that the session Id for javascript  {!API.Session_Id}, controller  and global class are different.