2.9. Step 9 - Delete a customer

We want to get rid of customers. For this we have to change little in the custorms.ui form: a button "Delete" with the following 'action' property:

CustomerDelete customer {id={customer.selected}}

We also want to reload the customer list after deletion. For now we just set add a 'form' property with the value of 'customer', this is the simplest way to reload the list of customers after the deletion:

We add another map for the 'CustomerDelete' request in tutorial.dmap:

COMMAND CustomerDelete CALL DeleteCustomer;

We also add a new form 'CustomerDelete' to the simpleform file Customer.sfrm which allows us only the specify an 'id' attribute of the customer to delete:

FORM CustomerDelete
    -root customer
    id !@string


Finally we add the implementation of the delete transaction in Customer.tdl:

TRANSACTION DeleteCustomer
    DO DELETE FROM Customer WHERE id=$(id);

Executing the request we see in the wolfclient debug output:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE customer SYSTEM 'CustomerDelete'>
<customer id="3"/>


Seems ok, customer gone. :-)