Salesforce Certified Platform Developer II — Question 22
A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field.
<apex:selectList value="{!selectedIndustry}">
<apex:selectOptions values="{!industries}"/>
</apex:selectList>
When a user changes the value in the industry select list, the table of Accounts should be automatically updated to show the Accounts associated with the selected industry.
What is the optimal way to implement this?
Answer options
- A. Add an <apex:actionFunction> within the <apex:selectOptions>.
- B. Add an <apex:actionFunction> within the <apex:selectList>.
- C. Add an <apex:actionSupport> within the <apex:selectList>.
- D. Add an <apex:actionSupport> within the <apex:selectOptions>.
Correct answer: B
Explanation
The correct answer is B because using <apex:actionFunction> within the <apex:selectList> allows for an action to be triggered when the selection changes, enabling the update of the Accounts table. The other options do not correctly initiate the necessary action to refresh the Accounts based on the selected industry.