The Label control
The Label control is a simple but yet very powerful control in PowerForms/HTML, since it can contain any kind of HTML content required. So it can serve as a simple control caption, or it can display complex data retrieved from a List Query or a web service call.
Type : Label
Provides a unique name for the control.
Indicates if the control is
- Bound to list column
- Is a label for a control bound to list column
By default, when opening a form that has no saved customization, the system generates one control and one label (for the control caption) for each list column found in the selected content type.
Enabled for new records
Enabled for existing records
The expression should return a boolean value.
For example :
form.FieldValue("c_Status") != "Rejected" || form.UserID() == "1"
This property defines how the control will get its value.
Here are the available options :
- The value is Static (this is the default for label controls)
- The value will be provided by the user (Not applicable for labels)
- The value will be calculated by a formula
- The value will be retrieved from a list query
- The value will be provided by a web service call
- The value will be provided by a SQL query
A static text must be set in the appropriate designer control.
If the formula contains references to other controls, dependencies will be automatically identifies during run-time and the value will be updated to reflect changes.
form.FieldValue("c_Active") ? "Yes" : "No"
There is an additional option that instructs the form to perform calculations only for new records. Existing records will keep their original value.
A predefined list query is bound to the value of the control. So during form initialization, the specified list query is executed and if it returns any item, it selects the first one and it will apply the value to the label based on the following rule :
If a Field Name has been selected in the corresponding box, that specific column will be used from the list item to fill the control value.
If the Field Name is left blank, the first column retrieved will be used.
The same as above, the required web service is selected and after the web service retrieves data, the first item will be used to update the control value. If no Field Name is set, the control will receive the first field of the retrieved item.
Works the same way ListQueries and Web Service works.
The default value has any effect only of the control is bound to a list column.
For unbound controls, the default value is ignored.
You may set a static value here or use a formula by starting your input with the "equals" (=) sign.
="User : " + form.UserFullName()
Defines the width of the control.
When the value is zero, the maximum allowed width will be used.
Defines the control height.
If the value is zero, the height property will not be set.
Defines the horizontal alignment of the parent cell (values : left, right, center)
Defines the vertical alignment of the parent cell (values : top, bottom, center)
Defines the fore color of the control
Not applicable for the label control
Defines the color of the parent cell.
Declares the font size of the text
Sets the margin applied to the control, that is, the spacing between the control and the cell borders.
Changes the weight of the font used
Changes the font style for the control text
Not Applicable for this control
Sets a tooltip for the control.
Sets the script that will be executed at the value-change event of the control.
var value = form.GetControl("c_Title").GetValue();
if (value == "Open") form.HideSection("Details");