Improve administration forms: MX Widgets

In this section of the tutorial, you will improve the form elements added automatically by NeXTensio. Improvements to be made include allowing the administrator to restrict the number of characters that can be used for the short description, or use a created on / modified on feature.

 

For the first improvement, open the admin/detail_art page in Dreamweaver. This page contains the form that allows editing or inserting new articles, and it contains several form elements: a drop-down menu for the topic selection, a text-field for the title, a text field for the short description field, and a KTML control, added in the previous section, for the page content. Also, you can decide if the article is visible or not, by using a drop-down menu.
  1. The element you'll modify is the short description text-field. To allow entering the description easier, convert the text field into a text area (select the text field and in the Property Inspector, select the Multi Line radio button). As it will be stored in the table as a 255 character length field, there should be a way to stop users from entering more. The Restricted text area widget does just that.
  2. To apply the Restricted Text Area server behavior, select it from the Server Behaviors tab -> MX Kollection-> Form Controls.
  3. Configure it to display the character counter next to the text area, and set a message to be displayed when the maximum number of characters has been reached:


  4. When done configuring the server behavior, click the OK button to apply the server behavior. Besides the new server behavior in the server behaviors tab, there are no other major changes in the page. When you preview in the browser, a text box displaying the number of characters that you can enter is displayed next to the text area used to enter the short description of the article:


To add the created on / modified on features for articles, you would first have to modified your database, and add a new field which will store the modification data. Then, you must use the Manage NeXTensio Form Wizard to add the new field to the form. Configure the original date to be displayed on Insert only, and the modification date field only on update. To learn exactly how to implement this improvement, check the How To implement created on / modified on section of the manual.