Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Dreamweaver CS4 Dynamic Development takes users to the next level in their understanding of the application. David Gassner demonstrates the installation of Apache, MySQL, and PHP for Mac OS X and Windows. He also shows how to define sites, integrate ColdFusion and PHP, implement AJAX-style pages with the Spry framework, add visual effects, and present XML-formatted data. David explores Dreamweaver's new features, Live View and Live Code, showing how they can be used to build and test web pages before they go live. Exercise files accompany the course.
Just as when creating a data entry form that allows users to insert data into a database table, when you create a form that will allow the user to update the data, you can also choose between using a wizard that creates the form and all of the server behaviors in a single step or you can create your own custom form and then apply the server behaviors. In this video, I'll show you how to use the Record Update Wizard. This wizard will take a page that already has the data that needs to be updated, that is, a record set containing a single row from a database table, and it will generate a complete data entry form and all of the required server behaviors.
I am starting with the page Title Insert. This page already has two record sets. Just as with the insert form that I built previously, I'm going to use these record sets to populate lists of available data that will be a part of the form. Now, I'm going to save this page with a new name. I'll select File > Save As, and I'll give the page a new name of titleupdatewithwizard. Now, I'm going to add another record set. This record set will contain the data for a single row of the database table.
I will go to the Bindings panel and click the Plus button and select Recordset (Query). I'll name the record set rsTitle. Notice that it's a singular name rather than rs Titles because it's going to contain a single row of data. I'll set the Connection to dw_bookstore and the Table to titles, and I'm going to leave all of the columns selected because I want the user to be able to modify all of the data in the database table. Now, I'm going to apply a Filter. The Filter should always be applied here to the primary key column of the database table. The primary key column, that is, the unique identifying column, is title _id and I'm going to set the Filter to match a URL Parameter that's a value that's passed in as part of a hyperlink, and the name of the URL Parameter will match the database column name title_id.
Now, I'm going to click the Test button, and notice that I'm prompted for a value that I want to filter on. You must pass in a value here of an existing record if you want to see data returned correctly. I'll set the test value as BU1032, which I know is a valid title ID in one of the records, and I'll click OK and I'll confirm that I'm getting back a single row of data from the database table. Then I'll click OK and click OK again to close the Recordset Builder. Now, I'm ready to apply the wizard. I'll go the menu and select Insert > Data Objects > Update Record > Record Update Form Wizard. Here is the Wizard dialog box. As with most of these wizards that have to do with dynamic data, you must select a Connection, and a Table in this case the one you want to update. The Connection should be dw_bookstore again and the Table should be Titles. The Select Record From option asks you which record set the data to update is coming from, and I'll select rsTitle, which contains the one and only item.
You also need to indicate which is the primary key column, here called the Unique Key. And Dreamweaver will usually get this right, particularly with MySQL. Set the Unique key column to title_id and then click Browse to indicate which page you want to go to after the update is complete. I'll click the Browse button, and I'll select the titlelist page either .php or .cfm. Now, I'm going to indicate what kind of form controls I want to use for each item. Notice that the title_id is displayed as pure Text. You never update or change the Primary Key or the Unique Key column. So that value simply displayed but left alone.
The title is a text field. That's fine. Now, for the pub_id column, just as in the insert form, I'm going to use what Dreamweaver calls a menu. I'll select the list of form controls and choose Menu. Then I'll click the New Menu Properties button, and as before I'll set the Menu items From database and indicate that I want to pull the data for this column from rsPubs, getting the labels from pub_name and the values from pub_id. Notice that there is an item here called Select value equal to, and I'll scroll down to the end and I'll show you that we are matching the pub_id value of the current record set. If you wanted to change this for any reason, you would click the little Lightning Bolt button, and then select the column that you wanted to match.
So I'll cancel out of that and then click OK to save the change, and then I'll go through the same steps for the au_id column. I'll set the Display As option to Menu, click Menu Properties, Populate the menu items from the database. This time choosing the record set rsAuthors. I'll set the labels from au_lname and the values from au_id, check the code that's populating the current value as au_id and then I'll click OK. I will make one more change. For the Notes column, I'll change this value from a Text field to a Text area because this is a longer value, and I want the user to be able to type in as much text as they need to.
Those were all the changes. Now, I'll click OK and generate my form page. As in the previous example, when the form is generated, it will drop into a place in the page other than the content area. So I'll click into the form anywhere I like, then I'll go down to the Tag Selector and make sure I click the surrounding form tag and then cut to clipboard. Then I'll place the cursor inside the Content Area, press Enter to create a new paragraph, and paste from the clipboard, and that places the content that is the data entry form in the correct location in the page.
Now, I'll save and test the page. I'll preview it in an external browser. Now, in ColdFusion, you might see a default record show up, but if you don't see that happen in PHP, just go up to the browser's address field and add the following to the URL. Put in a question mark at the end of the URL and then put in the name of the field that's expected to filter on, title_id in lower case, and then an equals operator, and then the value of the primary key column in the row you want to test.
I will run the page again with those values and you should now see that the values from the database row show up in the form. I'll make a very simple change I'll go up to the Title, and I'm just going to modify the title, so I can see the value easily when I return to the List page. I'll change the title from the Busy Executive's Database Guide to DB guide and then I'll click the Update Record button, which will take me back to the Book List page, and then I'll locate the record that I just updated and show that it's been changed in the database and the new change is reflected in the list.
So that's how you use the wizard to generate the data entry form and all of the required server behaviors in a single pass. In the next set of videos, I'll show you an alternative approach creating the form yourself, and then applying the server behaviors after the fact.
Find answers to the most frequently asked questions about Dreamweaver CS4 Dynamic Development.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.