Salesforce Certified Platform Developer II — Question 254
What is the correct syntax for calling a controller action from a Visualforce page and updating part of the page once the action is completed? (Choose two.)
Answer options
- A. <apex:commandFunction action="{!Save}" value="Save" rendered="thePageBlock"/>
- B. <apex:actionFunction action="{!Save}" name="Save" rerender="thePageBlock"/>
- C. <apex:commandButton action="{!Save}" value="Save" redraw="thePageBlock"/>
- D. <apex:actionSupport action="{!Save} " event="onchange" rerender="thePageBlock"/>
Correct answer: B, D
Explanation
Option B is correct because <apex:actionFunction> is designed to invoke controller actions and allows for page rerendering. Option D is also correct, as <apex:actionSupport> can trigger controller actions based on events and refresh parts of the page. Options A and C are incorrect because they either use the wrong tags or incorrect attributes for rerendering functionality.