O'Reilly logo

The Developer’s Guide to the Force.com Platform by Phil Choi, Andrew Fawcett, Glen Martin, Rick Greenwald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Repopulating the selectList

In order to properly repopulate the Visualforce selectList, you can add AJAX functionality to your page, which is implemented automatically without having to write any Javascript code, whenever the user has changed the value in the Department list.

As you learned in Chapter 9, this interactive capability is easy to use with Visualforce.

1.
Add the highlighted code to your Visualforce page.
</apex:pageBlocksection>
     <apex:actionRegion >
         <apex:pageblocksection columns="1"
           title="Department">
            <apex:inputField
              value="{!Position__c.Department__c}"/>
            <apex:actionSupport event="onchange"
								rerender="dependentPositionType"
								status="departmentStatus"/>
								<apex:actionStatus id="departmentStatus"
								startText="Fetching position types..."/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required