TextBox
Text Box
A text box just lets the user enter a text and saves it. You can use various validators to check the input. For example, "nonEmpty" validator will display error that this field should not be left empty.
Documentation
Brixxbox app configurations allows you to add different controls in your app. Text box is one of the simplest and commonly used control. Its general properties are described below
General Properties
These properties defines how control behaves in Brixxbox.
Control Type
- For using Text Box control, "text input" 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.
Label
- It is the display value for control.
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.
Include in global search
- If checked, this allows this control to be included in global search scope of this application.
Select all on focus
- This property when checked allows to select all the text in the text box, whenever this text box comes in focus.
Input Mask RegEx
- This property allows you to set regular expression for input of text box. For example, ^[0-9a-zA-Z]*$. This regex allows digits from 0 to 9, small and big alphabets to be part of the input.
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.
Unit
- The property allows you to specify a unit character here. For example we can specify $ for US Dollar, € for Euro etc.
Load record on load
- If this checkbox is selected then Brixxbox will load the record using value of this text box as a key.
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 "Text Input". First of all, select "Text Input" from list of controls. After that you need to give a id to your textbox and create column in database if you want to store the input in database. Here we named it "tbdText". Also, add a public label for Textbox. I labelled it "Street Name". You can any text in it. For example, add name of street. When you save this record. It will be saved in database. This is the first usage. We can also use text box to display the results from other controls. Lets use address combobox here. It is the same combobox we used in combobox tutorial.
Now when we select the value of combobox, we also want to set the value of "tbdText". The value of "tbdText" will correspond to name of street of the address selected in combobox. For this purpose, we need to add "onchange" event on combobox and add a custom code for it. In this code, first of all, we get the id of address chosen in combobox then we load the complete record using Brixxbox "loadConfigRecordById". In the end we will set the value of "tbdText" by using "setFieldValue" function. In this function, the first parameter takes the controlId of control whose value we want to set and second parameter takes actual value.
Now save the app config and test it by selecting any value of address combobox. It will also set the street name text box with corresponding street name.
Last updated