ONLINEPROOFINGSITE.COM

photoshop soft proof - www.onlineproofingsite.com

Menu


Figure 26.16 shows the Name text box with the Name field bound to it. Also notice that the Properties Inspector shows the bind in the


Init Val field. Figure 26.16. The field should now be bound to the appropriate form object. [View full size image] 9. Up to this point, you used the Dynamic Form Elements submenu in the Server Behaviors panel to create the binding. As mentioned earlier, there's an easier and much more intuitive way: dragging and dropping from the Bindings panel. To use this method, switch to the Bindings panel and expand the Recordset node. 10. Drag the Username field into the Username text box similar to Figure 26.17. Figure 26.17. Drag the Username field into the Username text box to create a binding. [View full size image] 11. Repeat the process for the remaining text fields in the My Account page. Don't forget the employeeid Hidden Field; this is by far the most important binding! Save your work and test the results in the browser by pressing F12. The result should look similar to Figure 26.18. Figure 26.18. The first record in the Employees table is displayed in the My Account page. [View full size image]   Notice that the first record, (Ada's information) is displayed in the My Account page. This is because the application doesn't know who we are or what field is representative of us in the Employees table. In Chapter 29, "Security and User Authentication," we'll add functionality that allows the My Account page to identify our login with a specific row in the Employees table. Ultimately, the login functionality we will add will display the appropriate data in the My Account page. Updating a User in the Employees Table Now that you have the form created and all the objects are bound to the appropriate data fields, you are ready to add the functionality that enables users to modify their particular information. Remember the EmployeeID Hidden Field you added into the form? This number is eventually used in the WHERE clause of the update to track which employee we should modify information for. If it weren't for this field, the Update Record server behavior wouldn't be able to function properly. To add the Update Record functionality, follow these steps: 1. Place your cursor in the form and select Update Record from the Add (+) menu in the Server Behaviors panel. The Update Record dialog appears. 2. The Update Record dialog functions similarly to the Insert Record dialog except for the fact that you are required to specify the unique key column. For starters, select connDorknozzle from the Connection menu. NOTE As was the case with the Insert Record server behavior, the Update Record server behavior functions the same across the board for the ASP, ColdFusion, and PHP server models. There are slight differences however; the Update Record dialog for the ASP server model features a Unique Key column menu. From this menu, you would select the EmployeeID value and set the status of the form element in the Form Elements list to <ignore>. In the ColdFusion and PHP server models however, this menu doesn't exist. For these server models, you must pass the EmployeeID value. Next to the Submit As menu, enable the check box labeled Primary Key; making sure that check box is selected ensures that the form updates without failure. 3. Now choose the Employees table from the Table To Update menu.