![]() ![]() ![]() |
||
|
In Lesson 6: Creating a Main Application Page, you added buttons to the Trip Detail page to let users search and modify the trips database; however, because you had not yet written the code to implement these capabilities, ColdFusion displayed an error when you clicked the buttons. Clicking these button sends the user to the maintenanceaction.cfm page. In this exercise, you will create the Maintenance Action page (maintenanceaction.cfm).
ColdFusion creates a variable only for the button that the user clicked. You use the IsDefined
function to test for the existence of the variable, which determines which action the application takes.
<cfif IsDefined("Form.btnSearch")> <!--- Code to execute if the user clicked Search. ---> <cfelseif IsDefined("Form.btnDelete")> <!--- Code to execute if the user clicked Delete. ---> <cfelseif IsDefined("Form.btnEdit")> <!--- Code to execute if the user clicked Edit. ---> <cfelseif IsDefined("Form.btnAdd")> <!--- Code to execute if the user clicked Add. ---> </cfif>
|
||
![]() ![]() ![]() |