Write cover letter

In this section you will build the page that allows users write their cover letter online, and adds it in the database. Also, the form element that allows the user to actually write its letter will be a text-area enhanced with the KTML control, an online HTML editor. This way, the cover letter will not be in plain text format, but will be able to contain pictures and formatting.

Building this page is actually made up from two different actions:

  1. The first is to create the insert action, that will take user input and save it in the database.
  2. The second is to enhance the text area element used to write the letter, by replacing it with the KTML Lite control.

The steps to follow in order to create this page are as follows:

  1. Open the cover page from the user folder in Dreamweaver.
  2. Apply the Insert Record Form Wizard from the MX Kollection tab of the Insert panel. Configure it as shown below.
  3. In the first step set the table to insert into as cover_cvr, and the page to redirect will be the user's folder index:


                
  4. In the second one, a list of the fields that will appear on page is displayed: idusr_cvr and letter_cvr. You will have to change the properties for both of this elements, as follows:
    · For the idusr_cvr field, select the Text option in the Display as drop-down. This field stores the id of the user that wrote the letter, and as such it is safer to take it from the session variable. Simply hit the InterAKT dynamic data button (the blue lightning icon), and use the session variable kt_login_id. Then press OK to add it to the field:



    · For the letter_cvr field, set the Display as property to text area.


                        
  5. Now that you've set the properties for both fields, you can click the Finish button to exit the wizard and add all elements into the page.
  6. Remove the first row in the form, the one displaying the user ID. By removing it from the table, you do not remove it from the actual transaction, just from the HTML portion of the page.
  7. At this point you have a fully functional insert page, that allows a user enter a cover letter in plain text format, or even HTML, with all tags written by hand.

 

Now you will enhance the insert form, by replacing the standard text area with InterAKT's HTML editor, KTML. As mentioned in the beginning of this tutorial section, you have to download this extension, and install it.

Replacing the text area is a simple process, requiring only a small amount of actions:

  1. Select the text area in the page form.
  2. Apply the KTML Lite server behavior: in the server behaviors tab, click the Plus (+) button, then select KTML -> KTML Lite.
  3. When the KTML configuration dialog box opens, it will first ask if you want to check the InterAKT servers for a newer version. Assuming you've recently downloaded the extension, you can safely skip this step. Then define the correct options for your particular control: the folders for uploaded images and files, the toolbar buttons to display, the control's size etc:


                   
  4. For details concerning all of the interface's options, consult KTML's user manual. For the purpose of this tutorial, you can leave these options at their default.
  5. Once you click on the OK button, some files will be uploaded to your server, and you will notice that the page itself looks different. This is because the KTML control placed a translator instead of the regular text area:


                                                
  6. Now the page is completed, and you can save and access it in the browser, but only after you log on with a user account. You can compose a cover letter using complex formatting, such as tables, images, and when you hit the Insert Record button, it will save the HTML into the database, as in the example below:

 

Although you can now create a cover letter for the logged in users, the users cannot view what letters they have written and decide which to use. Also, this means that each user can enter several letters, without control. This section's purpose was to demonstrate the easy way to do things, and you can take it even further, by using a Content Management System for your site, as shown in this tutorial.