Check Unique Key

The Check Unique Key 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. allows the developer to check if a certain submitted value is unique before using it in 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.. This means that you can check the table for another entry, to ensure no duplicates exist.

To add a Check Unique Key trigger A trigger is a SQL procedure that performs an action when a transaction (INSERT, UPDATE, DELETE) occurs. You can use triggers to perform validation of input data, to automatically generate a value for a newly inserted row, to read from other tables for cross-referencing purposes, or to support alerts through e-mail messages. into the page, you must follow the next steps:

  1. First create an Insert, Update, Custom or Login transaction. The server behavior is implemented as a trigger, therefore a transaction must exist on the page, so that the trigger can register to it. If more then one transaction exists, the trigger will register to all of them.
  2. Access the server behavior from the Application panel, Server Behaviors -> + -> MX Kollection -> Form Validation -> Check Unique Key.
  3. The user interface that opens is divided into two tabs. Configure these tabs as follows:
    ·  The Basic tab, where options regarding the field and value to check can be set.
    ·  The Advanced tab, where you can set trigger properties.

  4. Once you're done setting the options, click OK to apply the server behavior.

The Basic tab

In this part of the user interface you can set options regarding what table field to check:

 

To set the dialog box options, follow the next steps:

  1. In the Table drop-down menu, the table used in the transactions on page is automatically selected and the drop-down menu is disabled.

  2. In the Column drop-down menu all fields belonging to the table selected above are displayed. Select the field to check for unique values.

  3. In the Error message text area enter the text to be displayed if another entry has been found in the table. You can use the InterAKT Dynamic Data (the lighting bolt icon) to build the message.

  4. The three buttons in the top right corner of the interface offer you the next functionalities:
    ·  Click OK when you are done configuring the trigger.
    ·  Click Cancel to exit without applying the new settings.
    ·  The Help button opens this help page.
    These buttons are common to both tabs of the Check Unique Key interface.

  5. Click on the Advanced tab to continue with configuring the trigger.

The Advanced tab

This section of the dialog box allows setting the trigger properties:

 

For instructions on completing this step, see the Advanced tab. For the Check Unique Key trigger, by default the Priority is set to 30 and the Type is BEFORE, as it should execute before the transaction takes place.

The server behavior added this way can be edited later by double-clicking its name in the Server Behaviors tab of the Application panel.

Related Topics