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
advlgxpmadvlgxpm 

Drop down for lookup objects

Is it theoretically possible to have a <select> or something where the <option> values are dynamically generated from SOQL and/or another value on the page or in a query string?

ie. the Contact input field on a custom Case VF page would could instead be a Select drop down list filtered by the current value contained in the Account field on the same page(like js document.GetElementById() ) or perhaps the querystring of the record would have AccountId=0000000000 and the Contact drop down would be filtered by that value.

Could you write something in APEX like that which you could reuse and pass parameters into to do the SOQL that produced the options in a drop down list?
jpizzalajpizzala
Are you referring to the something that can be accomplished outside of the <apex:selectOptions> functionality?  To me, it sounds like what you are requesting is already available.  Check out the selectOptions component in the Visualforce component reference.
advlgxpmadvlgxpm
perfect, thanks
RickyGRickyG
And check out Chapter 12 of the Developer's Guide (part of the library available here) for an example of exactly this type of functionality.