Update Multiple Records

This server behavior performs multiple database record updates when an event on the page is triggered. It updates the available records in the selected database table using the defined connection.

A form specified on the page contains the form elements necessary to pass data to specific columns within the database for records to be updated. A single update form is contained within the Dreamweaver Repeat Region server behavior, which repeats the form for the selected number of records from the specified recordset. Setting the values for the form elements to the columns in the recordset populates them with corresponding column data for the given record.

When the Update Multiple Records server behavior is applied, the DataAssist Repeat Selection server behavior is applied as well (if not already applied to the form), incrementing the names of the repeated form elements to allow the records to be correctly correlated with the records they are to update. This allows for the display and update of each record populated in the repeating form using the multiple iterations of the update form.

It is necessary to define how the updates are triggered on the page, as well as where the page is to redirect upon completing the inserts, and whether or not to preserve the querystring and pass it to the redirect page.

You must also map the form fields in your repeated update form on the page to the database columns that are to contain the record data. Ensure that the inserted data is formatted according to the correct datatype for the given column.

Note: This server behavior does not work with forms that use a multipart encoding type (i.e. enctype="multipart/form-data")

Access

The Update Multiple Records server behavior is accessible in the following location:
  • Server Behaviors panel > Plus icon (+) > WebAssist > DataAssist > Update > Multiple Record Update

General

Event

Determine the page event or trigger used to update the record information to the database from the form:

Trigger: Refers to a request, session variable, or other dynamic data events. The existence of a value for the specified variable triggers the update on a given page. A request object (such as a hidden form element) or a session variable must be submitted or passed to the page that has the server behavior applied to it in order for the update to execute. Available triggers are:
  • Any Form Post: Any form posted to the current page that the server behavior is applied to triggers the data update.
  • Before Page Load: The data update is triggered when the current page that the server behavior is applied to is loaded.
  • On Form Submit: Any form submitted on the same page that the server behavior is applied to trigger the data update.
  • Button [button name] pressed: The server behavior is triggered if the specified button on the page is clicked.
  • Dynamic Data: Server-side code can be specified in the dynamic data interface (accessed through the lightning bolt) to create a trigger specific to your needs if one in the list does not meet your requirements.
Repeated form: Select a form on the page that is contained within a region encompassed by the Dreamweaver Repeat Region server behavior, or the DataAssist Repeat Selection server behavior.

Database

The following criteria is necessary to properly configure your database information for use with this server behavior:

Connection: Selects the database connection used to connect to the database for your application. Select from a list of available connections defined prior, or click the Define button to configure a database connection.

Table: Selects the table within the chosen database that contains the data used by the pages you are creating

Key column: Specifies the column within the database that is a unique key for the records within the selected table. This determines the column that allows the identification of specific records by virtue of having a unique value.

Data type: Sets the data type for the key column to ensure that the data retrieved from the value source matches the database column. This is to verify data integrity and make sure that the correct record is updated. The following is a list of available data types to select, but please refer to your database to ensure proper correlation:
  • Text: Only accepts text values.
  • Numeric: Only accepts numeric values.
  • Date: Accepts date values using standard SQL syntax.
  • Date MS Access: Accepts date values from MS Access databases.
  • Checkbox: Y,N: Defines checkbox values in a database using Y and N.
  • Checkbox: 1,0: Defines checkbox values in a database using 1 and 0.
  • Checkbox: -1,0: Defines checkbox values in a database using -1 and 0.
  • Checkbox: MS Access: Defines checkbox values in a MS Access database.

After update

Sets the actions that take place after updating of the record.

Go to: Sets the redirect location that is loaded upon updating the records

Pass original querystring: If a query is currently maintained from prior to the update, checking this box will pass that querystring on to the redirect page.

Bindings

Map the repeated form elements or other source of specific record data to the database column receiving it. Select the correct datatype for the given database column to ensure data integrity. Note: Autonumber database columns should not be updated during the insert process.

Update values

Data type: Sets the data type for the selected database column the data is updated into. This is necessary to ensure data is updated using the correct data formatting criteria. The following is a list of available data types to select, but please refer to your database to ensure proper correlation:
  • Text: Only accepts text values.
  • Numeric: Only accepts numeric values.
  • Date: Accepts date values using standard SQL syntax.
  • Date MS Access: Accepts date values from MS Access databases.
  • Checkbox: Y,N: Defines checkbox values in a database using Y and N.
  • Checkbox: 1,0: Defines checkbox values in a database using 1 and 0.
  • Checkbox: -1,0: Defines checkbox values in a database using -1 and 0.
  • Checkbox: MS Access: Defines checkbox values in a MS Access database.
Value: Sets the source of the data to be updated for the selected column. Typically, this will be a form element, but you may also use server-side code to define the updated information.