To delete the current record in the right pane of a form, a user clicks Delete. The following example uses code from Group.htm, but the other forms (except Group Membership) work in a similar way. The following code fragment shows the attributes of the Delete button. The remove function is the event handler for the onClick event of the Delete button.
<td vAlign="top" width="33%">
<button class="Button" tabIndex="21" style="WIDTH: 100%" onClick="remove()" DISABLED id="button2" name="button2" LID="btn3">Delete</button></td></tr>
Clicking Delete causes the remove function to be called. The code verifies that the primary key is present (0 is not a valid value and indicates that the delete action is not valid). Values are assigned to hidden attributes on the form: procname (the name of a stored procedure) is set to lw_deleteGroup and actionBtn is set to DELETE. The form is then submitted. The following code illustrates this process:
function remove() {
var theForm = document.frmGroup;
if (theForm.GroupId.value.length != 0) {
if (confirm(L_ConfirmDelete)) {
theForm.procName.value = "lw_deleteGroup";
theForm.actionBtn.value = "DELETE";
theForm.submit();
}
}
}
The action attribute of the form contains the URL "..Scripts/postIt.asp" and postIt.asp is called. Using postIt.asp describes the next step in the process of deleting data.