• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Inserting New Records

The only real way to test a Content Management System is to manage some content. In this section, you’ll build and test an Insert Record page.

Open insert.cfm. The page should be blank except for the attached style sheet and the CF Page Encoding.

Choose Insert > Application Objects > Insert Record > Record Insertion Form Wizard.

Complete the Record Insertion Form dialog, and click OK:

Data Source: cf_dwmagic

User Name: blank

Password: blank

Table: News

After Inserting, Go To: index.cfm

Pass Original Query String: Unchecked

Form Fields:

news_id: Remove the field

news_date: Change the label to Date (MM/DD/YY): and make sure the submit as column is set to Text

news_title: Change the label to Title:

news_text: Change the label to News:


Every database system uses a slightly different way to store dates. Submitting your date information as plain text ensures that you can move your data easily between different database systems with little worry about breaking things.

Click the news_text form field (the field next to the News: label) in Design view, and press the Delete key to remove the field. As soon as the field is deleted, you should notice that the Insert Record server behavior has a red exclamation point next to it in the Server Behaviors panel. This is Dreamweaver’s way of telling you there is something wrong with the page. This will go away as soon as you insert the CF XHTML Editor.

With your cursor in the cell where you want to insert the CF XHTML Editor, choose Insert > ColdFusion Objects > Advanced > XHTML Editor.

Complete the XHTML Editor dialog, and click OK to add the XHTML Editor to your page.

Field Name: news_text. The field name should match the name of the field that you deleted.

Field Value: Blank. Because you’re inserting a new record, leave this blank.

Redirect: ie_only.cfm. This is the page to which you want to redirect users who don’t have IE 6.0.

CSS File: style.css. Because the Editor is actually rendered in an iFrame in insert.cfm, it needs it’s own CSS file to use for styling the preview.

Width: Blank. Leave this field blank to make the XHTML Editor size the field for you. The minimum value is 520 pixels.

Height: 300. This measurement is in pixels and will adjust the height of the editing area. The minimum value is 200.


Because the XHTML Editor has its own CSS file to use for previewing edits, you can use any CSS file you’d like for the preview. It doesn’t have to be the same one you’re using for your administrative pages.

Be sure to upload the Custom Tags directory to your testing server before testing your pages.

Inserting the CF XHTML Editor makes several changes to insert.cfm and your site. It inserts the editor and adds an onSubmit behavior to your <form> tag. The Commit XHTML Editor behavior is required in order for changes inside the editor to be added to your database. It also creates a Custom Tags directory at the root of your site.

Save your work.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint