Add a BUTTON to a FORM

You can add a self-defined button to a FORM using the BUTTON ID statement. To determine the behavior of the button, use the ON BUTTON ID statement.

To close a FORM, use the ON ENTER or ON EXIT statements (see Close a FORM). Once all ON BUTTON ID, ON ENTER, and ON EXIT statements are processed, the Form is closed.

BUTTON "Name of the button" ID ("id of the button")
ON BUTTON ID("id of the button") 
DO
  ASSIGN _Document.ButtonClicked := "id of the button" 
OD

The part of the script between ON BUTTON ID ("id of the button") DO and OD is executed when the user clicks the button. In the preceding example, a value is passed to the KCM Core script.

You should consider the following:

  • Buttons are declared at the FORM level. You cannot use BUTTON within nested FORM statements, such as in questions, groups, or tables.

  • Button IDs are case-sensitive.