Add and edit articles using the same form

Having a simple list of articles is of no real use in a CMS. You have to be able to add, delete  and also edit pages using a simple interface. When you created the listing using the NeXTensio List Wizard in the previous tutorial page, in the first step, you specified a file to use for the form: detail_art.php. After testing the page in the wizard, you may have noticed that when you click on the add / edit links, the browser points to the detail_art page, which is, for the moment, blank. Also, the delete buttons seem to have no effect whatsoever.

To create this page, you will use the NeXTensio List's counterpart: the Create NeXTensio Form Wizard, which will create all of the required elements.

Before you start this wizard, you should secure this page, in the same manner as the article listing page: apply the Restrict Access to Page server behavior, based on user name and password.

Once you've got your page secured, click on the Create NeXTensio Form Wizard from the MX Kollection tab of the Insert panel, and configure it as follows:

  1. In the wizard's first step, enter details regarding the table to use, and the means to access it:
  2. In the second step of the wizard, you have to define the columns that will be used in the transactions, and what form fields will be used:
  3. The wizard's third step deals with applying validation rules on the form fields. As there are no fields with special requirements, you can safely skip this step. Also, if you do not have MX Form Validation installed, there is no third step of the wizard.
  4. In the final step you can specify some display settings, or leave the fields at their default.

 

Now click on the Finish button to close the wizard's dialog box, and add all elements into the page. In Dreamweaver, you will have now all of the HTML form elements and some server behaviors. This page allows you to add, edit and delete entries. It can be called either from the article listing page, to edit or delete a specific record, whose ID is passed through an URL parameter, or directly, in which case, it will act as a normal insertion form:

 

 

Because you've applied the Restrict Access to page server behavior, you cannot simply preview the page in the browser, as it would redirect you to the login page. Once you login though, visit the Article listing page, and click on the edit link aside one of the articles. A page similar to the following will be displayed for the update operation:
 


 

Now, through these two pages, you can completely administer the articles.