# Buttons

**There are two buttons setup by default in the Komment object:**

**`Submit:`** Used to commit user inputs and trigger a saving action.

**`Clear:`** Used to clear the input in the current user has entered but not saved yet.

**You have the option to add three additional buttons:**

**`Add:`**&#x54;his will enable users to add new records to the data using Komment

**`Remove:`** This will enable users to remove records from the Komment table

**`Reset:`** This will reset the content of all widgets for the chosen record. i.e. as if no data had ever been entered into any of the widgets. This functionality is available in **Form** and **Popup** modes.

Below is a small GIF showing how Reset and Clear buttons work:

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FsqRev0xGuiRqSgRegygo%2Fimage.png?alt=media&#x26;token=edc9ce9f-ba5b-46b6-bef6-10acab7721e4" alt=""><figcaption></figcaption></figure>

## Settings

You find the button settings in the Button Settings section:<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FoxD3A9h77zA1XN7ADgKF%2Fimage.png?alt=media&#x26;token=00d2b447-5919-43a0-9470-34d20a8fd51b" alt=""><figcaption></figcaption></figure>

`Label`: Provide your own label to be displayed to end users

`Button Type`: Select `Submit` , `Clear` , `Add` , `Remove` or `Reset`

`Do Partial Reload:` Toggle Yes/No (default is Yes)

`Confirm before Reload:` Toggle Yes/No (default is No). Activates a dialogue when pressing submit.

`Confirmation header:` Define the header of the dialogue shown to end user.

`Confirmation message:` Define the message of the dialogue shown to end user.

## Add/Remove

### Add

When you have defined the `Add` button in the setup it is very easy for users to add new records to the data:

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FkleU1gEtbpFQfbZAIrDy%2Fimage.png?alt=media&#x26;token=67c45b44-a9f6-4e75-8a84-498bcc7eb3c0" alt=""><figcaption></figcaption></figure>

Behind the scenes Komment will generate a new record with an auto-generated ID. If you wish to let the user decide on an ID to add and show but still keep a unique ID saved each time you can use the below method:

**1. Load script:**

* Add a new ID field to your Fact table\
  ![](https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FOCqYTL9h3oXKou6UBmMF%2Fimage.png?alt=media\&token=ddf2d4a3-d2a8-4895-8f4a-74f514be0014)

2\. In the Komment object:

* Include both ID fields as widgets<br>

  <figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2F3wlS9FfFVRSOQnXEO0wH%2Fimage.png?alt=media&#x26;token=756aa3da-1b93-4069-b20a-c632c0f11013" alt=""><figcaption></figcaption></figure>

Hide the original ID field<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2F6ywjcgKETpygTwSXAvDR%2Fimage.png?alt=media&#x26;token=ebae0f52-6b4a-4590-8811-2ae3c130e526" alt=""><figcaption></figcaption></figure>

The newly created ID field 'DriverID' should be shown<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FPZU62lwfSYfYeZEg1k1l%2Fimage.png?alt=media&#x26;token=725fc232-4428-404c-bda3-2095cd5f4e84" alt=""><figcaption></figcaption></figure>

The Add form will then show the DriverID and not the original ID<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2Fnuwvv8Gutd6qZolUk2hh%2Fimage.png?alt=media&#x26;token=efa24d0a-2121-41e0-b447-38143bf5d71f" alt=""><figcaption></figcaption></figure>

After adding a record the Komment table and related audit trail will look like this:<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FlHRMPIrFGhDbozoCfDjG%2Fimage.png?alt=media&#x26;token=e3b09058-8e2b-49af-9b33-66889fb7e99f" alt=""><figcaption></figcaption></figure>

### Remove

Depending on which Mode you have Komment set to, there are different ways of how to use the `Remove` button.

`Table Mode:` Here you enable the remove functionality by pressing `Batch Edit` => Select the records you want to remove => press `Edit` => press `Remove`

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FGoz9UKHaA7H4TPXt9X7b%2Fimage.png?alt=media&#x26;token=718d2050-ed8d-4a88-9d91-4984bb037a8e" alt=""><figcaption></figcaption></figure>

`Form Mode:` In Form mode the remove button is directly visible to the user.<br>

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FaBExEff5OdyTd75ONFCD%2Fimage.png?alt=media&#x26;token=1787ae39-429b-4c65-a21b-a2bc0072ed19" alt=""><figcaption></figcaption></figure>

Popup Mode: In Popup mode the remove action can be performed directly by pressing the trash can icon on the button.

<figure><img src="https://4099892881-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdGSelEVi2ug2LCBzJx5%2Fuploads%2FiTnouT2QrK9WXffqd9S0%2Fimage.png?alt=media&#x26;token=35b433ea-b19d-4333-bc14-14fb05cf5a53" alt=""><figcaption></figcaption></figure>

### State

When removing records the records are not actually deleted. Instead Komment handle the status of each record by introducing a `_state`field. The `_state` field can take three values:

* modified
* removed
* new

This field is saved with each data entry or record removal and is available in the stored Komment table along with the `CreatedBy` and `CreatedAt` fields.
