page

page

ConnexCS Page Component

Methods

(static) addClassName(fields, disabled)

Source:

Add style class to form item. This is opposite of removeClassName function

Example
var formData = {name: 'XYZ', age: 28, country: 'England'}
.custom-style {
	background: red;		
}
var className = 'custom-style'
var fields = ['name', 'age']
this.addClassName(fields, className)
// Now the 'background color' of Name and Age fields are 'red' in color
Parameters:
Name Type Description
fields Array
disabled Boolean

true/false

(static) database(name)

Source:

Access database for List(get all records), Read (get a record), Update (update a record), Delete (delete a record). This is an Object of functions. Click Here

Parameters:
Name Type Description
name string

Database name

(static) disabled(fields, disabled)

Source:

Dynamically set whether a form field is disabled

Examples
// Disable name and age fields from user interaction
var formData = {name: 'XYZ', age: 28, country: 'England'}
var fields = ['name', 'age']
this.disabled(fields, true)
// 'name' and 'age' fields in the form are unclickable and unchangeable
// Enable name and age fields for user interaction
this.disabled(fields, false)
// 'name' and 'age' fields in the form are now enabled for user interaction
Parameters:
Name Type Description
fields Array
disabled Boolean

true/false

(static) display(fields)

Source:

Display/Show Fields. This is opposite of hide function

Example
var formData = {name: 'XYZ', age: 28, country: 'England'}
var fields = ['name', 'age']
this.display(fields)
// Displays only 'name' and 'age' fields in the form
Parameters:
Name Type Description
fields Array

(static) getComponent(name) → {Object}

Source:

'dialog' is the ID field in the 'Component Attribute' tab

Example
var myDialog = this.getComponent('myDialog')
// myDialog component object
Parameters:
Name Type Description
name string

The component name

Returns:
  • Component Object
Type
Object

(static) getData(isValidateopt) → {Promise.<Object>}

Source:

To get form data

Examples
Validate form data Object by default
try {
	var data = await this.getData()
	// if success returns validated data as an object {name: 'XYZ'}
} catch (err) {
	// returns  err message
}
	}
var data = await this.getData(false)
// data contains {name: 'XYZ'}
Parameters:
Name Type Attributes Default Description
isValidate Boolean <optional>
true
Returns:

All of the form data

Type
Promise.<Object>

(static) getValue(fieldName)

Source:

Get A Value From An Object

Example
var myData = {name: 'Joe Blogs', age: 30};
this.getValue('name')
Parameters:
Name Type Description
fieldName string

Field Name

Returns:

'Joe Blogs'

(static) getValues() → {Object}

Source:

Get the values of all fields in the dialg

Example
var data = this.getValues()
console.log(data) // {name: 'XYZ', age: 28, country: 'England'}
Returns:
Type
Object

(static) hide(fields)

Source:

Hide Fields. This is opposite of display function

Example
var formData = {name: 'XYZ', age: 28, country: 'England'}
var fields = ['name', 'age']
this.hide(fields)
// Displays only 'country' field in the form
Parameters:
Name Type Description
fields Array

['name', 'age']

(static) refresh()

Source:

refresh the form, when the form data changes, you need to call this method for re-render

Example
this.refresh()

(static) refreshFieldDataSource(field, args)

Source:

Refresh the datasource data bound to the form field

Example
Get Provider Rate Cards When Provider Field Is selected
var providerId = 1789
var providerRateCards = this.refreshFieldDataSource('card', {id: providerId})
Parameters:
Name Type Description
field String

Datasource name

args Object

key-value pair

(static) removeClassName(fields, disabled)

Source:

Remove form item style class. This is opposite of addClassName function

Example
var formData = {name: 'XYZ', age: 28, country: 'England'}
.custom-style {
	background: red;		
}
var className = 'custom-style'
var fields = ['name', 'age']
this.removeClassName(fields, className)
// Now the 'background color' of Name and Age fields are not 'red' in color
Parameters:
Name Type Description
fields Array
disabled Boolean

true/false

(static) reset()

Source:

Reset Form Fields Data

Example
this.reset()

(static) scriptForge(name, data, fn, args) → {Promise.<Boolean>}

Source:

Access scriptForge

Parameters:
Name Type Description
name string

script forge name

data Object
fn string

function name

args Object

arguments

Returns:

Validation Success or Failure

Type
Promise.<Boolean>

(static) sendRequest(name, args, extendOptions) → {Promise.<Boolean>}

Source:

send a request to GET, POST, PUT, DELETE

Example
try {
	var res = await this.sendRequest('customer')
	// if success returns response and data as an array [{id: 1, name: 'XYZ'}, {id: 2, name: 'JOE'}]
} catch (err) {
	// returns  err message
}
Parameters:
Name Type Description
name string
args Object

arguments, datasource parameters

extendOptions Object

extendOptions

Returns:

Validation Success or Failure

Type
Promise.<Boolean>

(static) setData(Value)

Source:

Set Data

Example
var myData = {name: 'Joe Blogs', age: 30};
this.setData(myData);
Parameters:
Name Type Description
Value Object

(static) setOptionData(fields, newData)

Source:

Dynamic option data assignment

Example
// pending
var formData = {name: '', age: 28, country: 'England'}
var field = ['name']
var newData = {}
this.setOptionData(fields, newData)
Ask Jon
Parameters:
Name Type Description
fields Array
newData Object

key-value pair

(static) setOptions(fields, options)

Source:

Set Form Field Configuration Item

Example
// Make Name field: Have a default value, a placeholder and as required
var formData = {name: '', age: 28, country: 'England'}
var field = ['name']
var options = {defaultValue: 'Default Name', placeholder: 'Name', required: true}
this.setOptions(fields, options)
Parameters:
Name Type Description
fields Array
options Object

key-value pair

(static) setRules(field, rules)

Source:

Set Form Field Validation Rules

Examples
// Make Name as a required field
var field = 'name'
var rules = [
{ required: true, message: 'Name is requried' }
]
this.setRules(field, rules)
// Remove name as a required field
var field = 'name'
var rules = [
{ required: false }
]
this.setRules(field, rules)
Parameters:
Name Type Description
field string
rules Array

Array of Objects

(static) validate(fieldsopt) → {Promise.<Boolean>}

Source:

Validates the form data or a key-value pair // Returns Both The Success And Failure Results

Examples
Validate Only A Set Of Array Of Fields
var formData = {name: '', age: 28, country: 'England'}
var fields = ['name', 'age']
this.validate(fields)
If No Array Of Fields, Validates The Entire Form
this.validate()
Parameters:
Name Type Attributes Default Description
fields Array <optional>
[]
Returns:

Validation Success or Failure

Type
Promise.<Boolean>