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
Name
Provides a unique name for the control.
Binding
Indicates if the control is
- Unbound
- 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
Not applicable
Enabled for existing records
Not Applicable
Required
Not Applicable
Enabled Formula
Not Applicable
Visibility Formula
Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.
The expression should return a boolean value.
For example :
form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”
Value
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
Static value
A static text must be set in the appropriate designer control.
Formula
A javascript expression must be set that will provide the value for the 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.
Example :
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.
List Query
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.

Web Service
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.
SQL Query
Works the same way ListQueries and Web Service works.
Default Value
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.
Example :
=”User : ” + form.UserFullName()

Width
Defines the width of the control.
When the value is zero, the maximum allowed width will be used.
Height
Defines the control height.
If the value is zero, the height property will not be set.
H.Alignment
Defines the horizontal alignment of the parent cell (values : left, right, center)
V.Alignment
Defines the vertical alignment of the parent cell (values : top, bottom, center)
Fore Color
Defines the fore color of the control
Back Color
Not applicable for the label control
Cell Color
Defines the color of the parent cell.
Font Size
Declares the font size of the text
Margin
Sets the margin applied to the control, that is, the spacing between the control and the cell borders.
Font Bold
Changes the weight of the font used
Italics
Changes the font style for the control text
Not Applicable for this control
Tooltip
Sets a tooltip for the control.
Sets the script that will be executed at the value-change event of the control.
Example :
var value = form.GetControl(“c_Title”).GetValue();
if (value == “Open”) form.HideSection(“Details”);
else form.ShowSection(“Details”);
Control Properties and Methods
The form control represents an object that holds the details for the control on the form (type, position, layout details, etc).
References to those objects can be obtained using the form.GetControl(name) method.
GetValue()
Return type : string
Gets the current value of the corresponding control.
Note :
Date controls return the date in ANSI format (yyyy-MM-dd and yyy-MM-dd HH:mm:ss)
Number controls return the value in US format
Lookup controls return the value in the ID;#TITLE format
MultiLookup controls return the value in the ID1;#TITLE1;#ID2;#TITLE2;#… format
Example :
var value = form.GetControl(“c_Status”).GetValue();
if (value != “Open”)
form.GetControl(“c_Priority”).SetValue(“Normal”);
SetValue(value)
Return type : None
Used to set the value to a specific control.
The value must be provided in the same format with that used by the control when it returns its value (using the GetValue method)
Example :
var customer = form.GetControl(“c_Customer”);
form.GetControl(“c_Title”).SetValue(“The Customer is ” + customer);
GetValue_Name()
Return type : string
It is used for lookup controls and returns the TITLE part or its ID;#TITLE formatted value
Example :
var a = form.GetControl(“c_Category”).GetValue();
// returns “1;#CategoryA”
var b = form.GetControl(“c_Category”).GetValue_Name();
// returns “CategoryA”
GetValue_Value()
Return type : string
It is used for lookup controls and returns the ID part or its ID;#TITLE formatted value
Example :
var a = form.GetControl(“c_Category”).GetValue();
// returns “1;#CategoryA”
var b = form.GetControl(“c_Category”).GetValue_Value();
// returns “1”
GetValues(separator)
Return type : string
Used for multi-value controls and returns the ID part of their values separated by the specified separator.
Example :
var a = form.GetControl(“c_Multi”).GetValue();
// returns “1;#Open;#2;#Closed”
var b = form.GetControl(“c_Multi”).GetValues(“-“);
// returns “1-2”
GetNames(separator)
Return type : string
Used for multi-value controls and returns the TITLE part of their values separated by the specified separator.
Example :
var a = form.GetControl(“c_Multi”).GetValue();
// returns “1;#Open;#2;#Closed”
var b = form.GetControl(“c_Multi”).GetNames(“-“);
// returns “Open-Closed”
ContainsValue(value)
Return type : bool
Used for multi-value controls and returns true if the value specified is one of the selected values of the control.
Example :
var control = form.GetControl(“c_Multi”);
var value = control.GetValue();
// returns “1;#Open;#2;#Closed”
var b = control.ContainsValue(“2”)
// returns true
var c = control.ContainsValue(“3”)
// returns false
ContainsName(value)
Return type : bool
Used for multi-value controls and returns true if the name specified is one of the selected values of the control.
Example :
var control = form.GetControl(“c_Multi”);
var value = control.GetValue();
// returns “1;#Open;#2;#Closed”
var b = control.ContainsName(“Open”)
// returns true
var c = control.ContainsValue(“Pending”)
// returns false
SetEnable(enableFlag)
Return type : None
Used to enable or disable a control.
Example :
var c = form.GetControl(“c_Status”);
if (c.GetValue() == “Open”) form.GetControl(“c_Status”).SetEnable(true);
else form.GetControl(“c_Status”).SetEnable(false);
SetVisible(visibleFlag)
Return type : None
Used to show or hide a control on the form
Example :
form.GetControl(“c_Status”).SetVisible(false);
ColumnTitle()
Return type : string
Returns the title of the underlying list column.
Example :
var title = form.GetControl(“c_Title”).ColumnTitle();
ColumnDescription()
Return type : string
Returns the description of the underlying list column
Example :
var desc = form.GetControl(“c_Title”).ColumnDescription();
GetLookupItems()
Return type: array of objects
Works only with Combobox, RadioButtons and Checkboxes controls.
Returns an array of objects, which contain the items currently residing in the selected control.
Example:
var items = form.GetControl(“c_Control1”).GetLookupItems();
alert(pf.ObjectProperties(items));
SetObjectDataSource
Return type: None
Definition:
SetObjectDataSource(objectArray, “DisplayFieldName”, “ValueFieldName”)
Can be used to set static values to lookup-type controls.
Works with Combobox, RadioButtons, Checkboxes, LookupPicker, MultiLookupPicker controls.
Example:
Remove
Return type: None
Definition:
Remove()
Can be used to set remove a control using script. You can use the following script in the form’s Load Completed script:
form.GetControl(“c_Control1”).Remove();
Move
Return type: None
Definition:
Move(sectionKey, row, col)
Can be used to set move a control using script to a different location(section, row and column). You can use the following script in the form’s Load Completed script:
form.GetControl(“c_Control1”).Move(“t_SectionKey”,0,0);
Control specific events you can tap into and listen, by registering handler functions.
LookupLoaded
Works only with Combobox, AutoCompleteTextbox, DropDownList, RadioButtons, Checkboxes controls.
This event will fire when a lookup-type control, such as the ones mentioned above, finishes loading its respective values.
Example:
We have a Combobox control, which contains continents. Our goal is to have Europe become the pre-selected value, as soon as the control gets populated with all continent values.
LookupLoading
Works only with Combobox, AutoCompleteTextbox, DropDownList, RadioButtons, Checkboxes controls.
This event will fire when a lookup-type control, such as the ones mentioned above, begins loading its respective values. You can use this event in the form’s Load Completed script:
DocumentUploading
Works only with a DocumentGrid control.
This event will fire as soon as you press the Upload button on the DocumentGrid control, just before the actual documents are uploaded.
Example:
Show a confirmation dialogue to the user, asking whether to upload the documents or not. If the user presses yes, the documents will be uploaded, otherwise they will not.
DocumentUploaded
Works only with a DocumentGrid control.
This event will fire, after a document gets uploaded, using the DocumentGrid control.
Example:
ValueChanging
This event will fire, whenever a control’s value is changed .
Notable properties:
e.OldValue, contains the value before the change happened
e.NewValue, contains the new value.
Example:
Helper Methods
/0 Comments/by KonstantinosThe ImageCheckBox control
/0 Comments/by KonstantinosThe Button control
The button control is used to trigger user defined actions:

The value of the control (see “Value” section below) defines the display text of the button. The actions to be executed once the button is clicked are defined in the Extra Configuration section (see “Extra Configuration”).
Type : Button
Name
Provides a unique name for the control.
Binding
Not applicable for the button control. It should be always unbound.
Enabled for new records
Sets if the control will be enabled or disabled when the forms handles a new record
Enabled for existing records
Sets if the control will be enabled or disabled when the forms handles an existing record
Required
Marks the cotnrol as Required.
By default, the system recognizes required fields and marks them with this flag. Additionaly, controls can be marked as required event if the bound column is not.
Enabled Formula
Set an expression then will be evaluated during run-time and enable or disable the control.
The expression must be in javascript and should return a boolean value.
Dependencies between controls are automatically identified and the expression is re-calculated every time a control affecting the formula changes.
Example :
form.GetControl(“c_Status”).GetValue() != “Open” && form.UserInGroup(“Administrators”)
Visibility Formula
Define a valid formula (using javascript) that will be evaluated during runtime to show or hide the control.
The expression should return a boolean value.
For example :
form.FieldValue(“c_Status”) != “Rejected” || form.UserID() == “1”
Value
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
Static value
A static text must be set in the appropriate designer control.
Formula
A javascript expression must be set that will provide the value for the 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.
Example :
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.
List Query
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.

Web Service
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.
SQL Query
Works the same way ListQueries and Web Service works.
Default Value
Not applicable (control is unbound)

Width
Defines the width of the control.
When the value is zero, the maximum allowed width will be used.
Height
Defines the control height.
If the value is zero, the height property will not be set.
H.Alignment
Defines the horizontal alignment of the parent cell (values : left, right, center)
V.Alignment
Defines the vertical alignment of the parent cell (values : top, bottom, center)
Fore Color
Not applicable for the button control.
Back Color
Not applicable for the button control.
Cell Color
Defines the color of the parent cell.
Font Size
Declares the font size of the text
Margin
Sets the margin applied to the control, that is, the spacing between the control and the cell borders.
Font Bold
Changes the weight of the font used
Italics
Changes the font style for the control text
Lookup Details
Not applicable for the button control.
Actions
The actions to be executed once the button is clicked are defined here. The sequence of the execution follows the order of the actions definition. In order to add an Action entry in this collection, press the
button. Each action has the following properties:
Type: Sets the type of the action to be executed. Available values:
- Script: Javascript code to be executed. See “Form Properties and Methods” and “Controls Properties and Methods” article for a list of available functions and code samples.
- SetValue: Provides a value (specified to the “Value” property) to the control specified in the “ControlName” property.
Value: The script to be executed (in case of script actions) or the value to be set on the control (in case of SetValue actions). For SetValue actions, references to controls are allowed, for example {c_Title}.
The following example will display a message to the form once the button is clicked, and then set the title’s text to the c_Description control:

Tooltip
Sets the tooltip (mouse over message) text displayed for the button.
Not applicable for the button control. Onclick scripts (actions) are defined in the Extra Configuration.
