Visual InterDev

       

Cancels the changes being made to the current record.

Syntax

object.cancelUpdate()

Parameters

object

A object.

Remarks

The cancelUpdate method aborts the changes being made by the updateRecord method to the current record and resets the record's fields to their original values.

When updating records, you can use the onbeforeupdate and onafterupdate events to trap errors.

Example

Often, in a data entry form, users are permitted to insert new records, update existing records, delete records, etc. If users are allowed to update records, they probably need the ability to cancel the operation as well.

The following code snippet shows how a user would cancel the update operation in a form:

function btnCancel_onclick()
{
   DTCRecordset1.cancelUpdate();
   DTCRecordset1.move(0);
}

This method will replace all the user-updated values on the form with the previous values. The move method is used only in the case of ASP pages as this forces the form to display the previous values. For the DHTML case, the move method is not necessary and is not used.