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.
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");
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);
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"
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"
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"
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"
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
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
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);
Return type : None
Used to show or hide a control on the form
Example :
form.GetControl("c_Status").SetVisible(false);
Return type : string
Returns the title of the underlying list column.
Example :
var title = form.GetControl("c_Title").ColumnTitle();
Return type : string
Returns the description of the underlying list column
Example :
var desc = form.GetControl("c_Title").ColumnDescription();
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));
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:
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();
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.
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.
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:
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.
Works only with a DocumentGrid control.
This event will fire, after a document gets uploaded, using the DocumentGrid control.
Example:
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: