I am trying to figure out how I would dynamically update the SelectOptions for multiple SelectLists on the same visualforce page.
I have a page where the user selects contacts that are associated with a previously selected account (step one of a wizard control). I have 5 SelectList controls on this page.
What I would like to have happen is when the user selects a contact in the first selectlist control, I update the selectoptions for the other controls to remove that contact as a select option (so the user can't select the same contact in multiple selectlists on the page).
I've been playing with the apex:actionFunction and the reRender attribute, but I can't seem to get this working.
Can anyone show me if it is possible to do what I've described above? Or provide an example of how you would accomplish this (assuming it's possible)?
Thank you!
Best Answer
You can accomplish this by adding an ActionSupport to each of the SelectOptions
Depending on how long your SOQL might take to run, you could also include an ActionStatus to show a "please wait" type of message each time it is rerendering (and updating your dependent lists).