Add button actions on your first form

Buttons can run form actions when users click them. You configure actions on the Actions tab when a button is selected.

Before you begin

  • Start from an empty form (or clear the canvas).

Add or select a button

Empty form with Components search set to Button and Button highlighted.Empty form with Components search set to Button and Button highlighted.
  1. Open Components.
  2. Search for Button.
  3. Drag Button onto the canvas.
  4. Click the button to select it (set the label to Save if you want).

Configure Actions

Save button Actions tab with onClick showAlert code action and alert in the editor.Save button Actions tab with onClick showAlert code action and alert in the editor.
  1. With the button selected, open Actions.
  2. Under onClick, add a Code action (for example showAlert).
  3. Open the code editor and put an alert in the action body, for example:
alert('Button clicked');
  1. Save the Code action.

You name a Code action when you create it in Designer. Its name and JavaScript body are stored with the form; it does not depend on application registration. A simple alert is enough to prove the click path works.

An action supplied by the host application is a separate Custom action. Developers register Custom actions, and authors can attach only the names that the application makes available under Custom.

Test in Preview

Preview mode after clicking Save, with an alert dialog showing Button clicked.Preview mode after clicking Save, with an alert dialog showing Button clicked.
  1. Click Preview.
  2. Click the Save button.
  3. Confirm the alert appears with your message.

Check the result

  • In Edit, Actions lists the onClick Code action.
  • In Preview, clicking the button runs that code (here, an alert).

Summary

Button behaviors live on Actions for the selected button. Start with a Code action and alert to verify the click path. Then add a Common action such as validate, or use a Custom action registered by your application for submit or integration behavior.

See also