brixxbox Wiki
Ask or search…
K

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

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
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
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.
Last modified 1yr ago