Now open up your home page (index.cfm) and create a blank line at the very top of the code.
The reason that the event handler has to be the first code executed is because of the static nature of
your web page. Since it can't actually respond to events in real-time, you need to register the event
before anything else happens so that the rest of code will know that it exists when executed.
Next, click on the cfoInvokeMethod button in your cfObjects toolbar a fill in the information below.
You will notice that we are now specifying the OnEvent field this time. Basically, this says that
the designated method will only be executed when that event is raised.
Once you complete that, your code should look like this...
index.cfm
<cf_cfoInvokeMethod
method="aPage.showHeaderGraphic"
onEvent="pageHeaderGraphic"
graphicFile="home_page.gif">
<cf_cfoCreateObject class="page" title="Home Page">
<cf_cfoInvokeMethod method="aPage.buildPageHeader">
<cf_cfoInvokeMethod method="aPage.buildNavigation">
<cf_cfoInvokeMethod method="aPage.defineMainContent">
<cf_cfoInvokeMethod method="aPage.buildFooter">
We're almost there. The last thing we need to do is create the method that the event handler is
calling - showHeaderGraphic
Move to Step 14 -->
|