FX Delete Multiple Records - (by Felice Di Stefano)
(support for PHP_MySQL, PHP_ADODB, ASP_Js, ASP_Vbs)

This server behavior will allow to delete multiple records from a table at one time using checkboxes as reference. It can be used also as a normal delete and for complex multi delete, assume that the delete do not delete only a record at any execution but all records which match the condition of the Where clause. The restriction is that a recordset must be always present as a reference.
The main purpose of this behavior is to delete all the checked records from a list, created by a repeat region and provided of checkboxes, with one click. Then you may also experiment other solutions at your own risk.

Applying

Create a recordset as your need, then create a form on the page and display the records inside the form with a repeat region, add a checkbox inside the repeat region and name it as you like, add a submit button outside the repeat region. Open the FX Delete Multiple Records from the server behaviors palette and apply the parameters. You may use it also with page navigation bar. (It would be recommended to apply the Recordset Repeat Region after the Delete Multiple).

Note for ASP model

You will have to add the [total records] source prior to apply this behavior if no recordset page navigation is used because its code is required for the execution of this action. If you don't want the display of any stats remove the string of code from the page by hands in code view to avoid to remove the required code.

Form: Select the form which will perform the delete.
Connection: Select the connection which must be the same used by the recordset .
Referrer Recordset: Select the recordset used to create the list from which to delete.
Checkbox Name: Select the checkbox name applied for the purpose.
Delete from Table: Select the database table from where records must be deleted.
Where Column: Select the table column which must be matched by the recordset value, usually a unique identifier as a ID if a single match is required at any loop, but not necessary you can perform complex deleting choosing a column which must be matched by the recordset value. Therefore if you select for example the column ID this will be compared to the ID column of the recordset.
Submit Button Name: Select the button which will submit this action.
Redirect To: At the end define where to redirect after deleting, to redirect to the same page you may insert the same page name or even leave it empty.

Hints

You may use it on a single record but you must add a checkbox anyway which, after the behavior is applied, you may convert to a hidden field.

Since the action is executed at the click of the selected submit button you may combine the update and delete in the same form just selecting a different submit button for any action.


by FELIXONE