Home > Products > BPC PowerForms > Knowledge Base > API Reference > The Button control

The 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").

Designer Properties

Type : Button


Provides a unique name for the control. 


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


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"


This property defines how the control will get its value.


Here are the available options :

  1. The value is Static (this is the default for label controls)
  2. The value will be provided by the user (Not applicable for labels)
  3. The value will be calculated by a formula
  4. The value will be retrieved from a list query
  5. The value will be provided by a web service call
  6. The value will be provided by a SQL query
Static value

A static text must be set in the appropriate designer control.


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) 

Layout Properties


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)


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


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


Changes the font style for the control text


Lookup Details

Not applicable for the button control. 


Extra Configuration


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.
ControlName: Applicable only for SetValue actions.

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:




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.