Create custom transactions in multiple steps

In order to gradually build an insert page containing specific fields, which you can manually define, you can use the form tools and the Server Behaviors panel. This procedure requires the adding of an HTML form that would allow users to enter data, and a Custom Transaction to insert records in a database table. The submitted information in the form can be saved in the database (by calling a stored procedure) or not. In the latter case, it could simply be sent as an e-mail to where it is needed to be known.

The form objects will be laid out in a basic table, which you can customize by using the Dreamweaver page design tools (make sure all the form objects remain within the form’s boundaries). To edit the server behavior, open the Server Behaviors tab of the Application panel (Window -> Server Behaviors) and double-click the Custom Transaction server behavior.

You can also build the custom form at once by using the Custom Form Wizard. For more information, see Create custom transactions in one operation.

First of all, add an HTML form to the page. In order to get more information upon this, see the paragraph about adding an HTML form to an insert page.

 

To add the Custom Transaction server behavior to an insert page, follow the next steps:

  1. Access the server behavior from the Application panel, Server Behaviors -> + -> MX Kollection -> Forms -> Advanced -> Custom Transaction.

  2. Complete the dialog box that pops-up, following the instructions below for each of the three tabs:
    · The Basic tab
    · The Fields tab
    · The Advanced tab

  3. Click OK when done.

Dreamweaver adds a server behavior to the page that allows users to insert records in a database table or send the new information via e-mail by clicking the Submit button on the form.

The Basic tab

The first step into completing the dialog box requires the user to input basic information about the transaction, like the database connection and the page to which it will be redirected:

 

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

  1. In the Connection drop-down menu select the database connection defined for your site; if you don't have a connection yet, you can use the Define button and create one now.
  2. In the First check variable drop-down menu select which element should act as a starter condition for the insert operation (either URL Parameter, Form Variable, Cookie, Session Variable, Server Variable, Entered Value), and type its name in the associated text-box.
  3. In the When finished, go to text box enter the page to be opened after the record is inserted into the table or click the Browse button to select the file page.
  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 server behavior.
    · Click Cancel to exit without the new settings to be applied.
    · The Help button takes you to this help page.
    These buttons appear on all three interfaces of the Custom Transaction server behavior.
  5. Click on the Fields tab to continue with configuring the server behavior.

The Fields tab

This dialog box allows you to add fields in your form. You can associate database fields with form controls:

 

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

  1. In the Fields area specify the form objects you want to include on the HTML form of the insert page. You have to add the fields manually, using the Plus (+) button. The Minus (-) button is used to remove fields from the form.
    You can change the order of the form objects on the HTML form by selecting a form object in the list and clicking the up and down arrows on the right top side of the dialog box.
  2. Specify the required settings for each data-entry in the HTML form by selecting a row (single click) in the Fields area and entering the required information in the boxes below the grid, as indicated below.
  3. In the Submit as drop-down menu select the data format accepted by your database table, or the one compatible with the further usage of this field content. For example, if the table column only accepts numeric data, select Numeric. All the options that you have are listed below: Text, Numeric, Double, Date, Check box: Y,N, Check box: 1,0, Check box:-1,0, File.
  4. In the Get value from drop-down menu select the source from where the value is retrieved: URL Parameter, Form Variable, Cookie, Session Variable, Server Variable, Entered Value, Form in page, File field.
  5. If the Variable name text box is displayed (it depends on the Get value from selection), enter the name for the variable. If the Value text box is displayed, enter a value, and if the Form field drop-down menu shows, select the suitable option.
  6. In the Default value text box, when enabled, enter the default value for the currently selected form field.
  7. Click on the Advanced tab to continue with configuring the server behavior.

The Advanced tab

This last step in configuring the server behavior requires the user to set some transaction options:

 

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

  1. In the Transaction name text box enter the desired name for the custom transaction. Be careful when choosing it, because it has to be unique on each page. By default, MX Kollection 3 assigns unique names to each transaction, and this setting should not be changed, unless you really know what you are doing.
  2. In the SQL query editable area you can write an SQL query for the current transaction (only if there is an active SQL connection). When putting together the query and choosing fields from the current ones, you can use the InterAKT Dynamic Data (the lighting bolt icon).
  3. After completing the user interface, click on the OK button to apply the server behavior, or Cancel to dismiss it without making any changes to your page.