# CheckBox

## **CheckBox**

A checkbox that can be checked (value: 1) or not (value: 0). For example, if you have an items application. You can use checkbox to show its availability.

### Demo

{% embed url="<https://youtu.be/Z72Ao2Pge5c>" %}

### Documentation

Brixxbox app configurations allows you to add different controls in your app. Check box is the easiest control. Its general properties are described below

**General Properties**

***

These properties defines how control behaves in Brixxbox.

* Control Type

\- For using Check box control, "Check Box" control type should be selected from drop down list.

* Control Id

\- For each Brixxbox app, this id should be unique. For Example: "\_abcdef". Brixxbox allows you to change its value only once. You can change this id to any value but it should be meaningful. Recommended way is to start with mandatory prefix(set in app). It can contain numbers, underscores, uppercase and lowercase letters. Brixxbox saves checkbox value in one bit.

* Label

\- It is the display value for control. For checkboxes, it makes sense to label them like "isAvailable" in the form of Yes/ No questions

* Data

\- This property specifies from where this control gets data. To set it, specify the controlId of data source. By default "Not in Database" option is selected.

* Refers to Config

\- You need to set this option if this is a field, that other fields refer to, to get data from another config.

* Default value

\- This value is set when an application is opened or a new record is created.

### Tutorial

This tutorial assumes that a user has an existing app and they want to add a new control of type "Check Box". First of all, select "Check Box" from list of controls. After that you need to give an id to your check box and create column in database. We also added two buttons "Set" and "Reset". For this tutorial we will follow the structure of demo given above.

We need to add code to our button "onClick" events. "Set" button will set the value of checkbox and "Reset" button will unselect it. Brixxbox accepts input for setting/resetting checkboxes in following formats: as an integer (0,1), as a string "0 or 1", as a Boolean (true or false). The code snippet of Set button is given here

![](https://26372517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbFVf8kVEpyVUCqsdCO3p%2Fuploads%2FJzVOsOi1FqYqaj1Basrs%2Fimage_2022-05-25_162434371.png?alt=media\&token=9a1dd41c-d462-45a3-b98a-5ae0f2c1a6e6)

When set button is pressed, it sets the checkbox. Similar is the case when the reset button is clicked it will uncheck the checkbox. After clicking set button our app will look like this

![](https://26372517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbFVf8kVEpyVUCqsdCO3p%2Fuploads%2FLhSlyQ8k0QzFCepARr0M%2Fimage_2022-05-25_162444969.png?alt=media\&token=963be5c2-3fd7-4e0f-bca0-2d275a2c9f7f)

In the last, there is one point you need to care about whenever you want to use true and false to set or reset the checkbox do it in these three ways 0, "0" or false. Do not use true or false as string values like "false" while setting the value of checkbox. It will result in unexpected behavior.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/controls/checkbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
