Exercise 5: Linking the Trip Edit page to the main page
As discussed in Lesson 7: Validating Data to Enforce Business Rules, the action page for the maintenance buttons on the main page is maintenanceaction.cfm.
You previously added code for the Search and Delete buttons. In this exercise, you add code for the Add and Edit buttons.
To link the Add and Edit buttons on the Trip Detail page:
- Open the maintenanceaction.cfm file in the my_app directory in your editor.
- Locate the
</cfif>
tag at the end of the file.
- Insert the highlighted code:
<cfelseif IsDefined("Form.btnEdit")>
<!--- Code to execute if the user clicked Edit. --->
<cflocation url="tripedit.cfm?ID=#Form.RecordID#">
<cfelseif IsDefined("Form.btnAdd")>
<!--- Code to execute if the user clicked Add. --->
<cflocation url="tripedit.cfm">
- Save the file.