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
jucuzoglujucuzoglu 

How do I access the current value of an APEX SelectList

I have an APEX select list on my page. And I would like to be able to load information via a SOQL query utilizing the selected value as a parameter.

 

How would I access the Select List value in my APEX?

 

For example does the visualforce tag have an ID attribute that I can then access somehow like ID.Value etc...

Best Answer chosen by Admin (Salesforce Developers) 
Alex.AcostaAlex.Acosta

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectList.htm

 

Are you taking how to access the list of values of the selected values? Either way the top example salesforce provides should suffice.

All Answers

Alex.AcostaAlex.Acosta

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectList.htm

 

Are you taking how to access the list of values of the selected values? Either way the top example salesforce provides should suffice.

This was selected as the best answer
jucuzoglujucuzoglu

Thank you for pointing me in the right direction. I used the example and did the following to make it work for me:

 

  • Created a Private string to store the selected value
  • Created getters and setters for the private string value
  • Created a SelectList whose value and ID were the same as the getter/setters (Note my situation allows only requires a single value to be selected.)
  • Created an ActionSupport that onchange rerenders a block.

What this allowed me to do was create a List of an SObject that returned a dynamic SOQL query filtered by the selected item and display that value via a table. And if the value changes the table updates.

 

Thanks again