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 A server behavior is a reusable component for server-side development. They add blocks of code to your pages for accomplishing specific tasks. Dreamweaver comes with several default server behaviors and the InterAKT extensions add many more to this list., 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 The redirect server behavior loads a new site page after a transaction A transaction is a group of SQL statements whose effects are logically connected. Anything from simple queries to inserting, and deleting operations can be considered a transaction, as well as more complex groups of several statements which accomplish a specific task. is executed. For instance, users could be automatically redirected to their inbox after they log in to the website. 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.

pr  k
08-02-2005

Question:

It\'s possible to add articles to the topics, but I can\'t add new topics. Just deleted all articles and topics, and now I can\'t make neither new topics nor new articles, cause the article need to have a parent-topic!

Answer:

We haven\'t covered this functionality in the tutorial. However, you can easily create a separate NeXTensio list for viewing topics and a NeXTensio form for creating and editing topics (following steps similar to those described in the tutorial).