Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Control object

Javascript API: Control object

Scroll Prev Next More

About Control object

The Control object allows you to work with the edit controls. Control object is available in the JavaScript OnLoad event of Add/Edit pages.

 

Before you start working with the edit controls, you need to get those controls.

getControl()

Use the getControl() method to get the controls by the field name and page ID:

Syntax

var ctrl = Runner.getControl(pageid, fieldname);

Example

var ctrl = Runner.getControl(pageid, 'Make');

controls.ControlManager.getAt(tableName)

To get all the controls of the table, you need to pass only the table name as the argument:

Syntax

var ctrlArr = Runner.controls.ControlManager.getAt(tableName);

Example

// Get all the controls for the 'Cars' table
var recCtrlsArr = Runner.controls.ControlManager.getAt('Cars');
// loop through all controls on the page making them all required
for(var i=0;i<recCtrlsArr.length;i++)
{
  var ctrl = recCtrlsArr[i];
   ctrl.addValidation("IsRequired");
}

Methods

Method

Description

addClass()

Adds the class to the control with a value.

addStyle()

Adds the style to the control.

addValidation()

Adds validation to the control.

clear()

Sets "" as the control value. If the control was not previously validated, removes the message that it was not validated.

clearEvent()

Deletes events.

getDispElem()

Returns a jQuery object - the element (input, textarea, select, etc.) that displays the value of the selected field.

getValue()

Reads the control value.

hide()

Hides the control.

invalid()

Gets the control status after the last validation.

isReadonly()

Gets the control readonly status.

makeReadonly()

Makes control readonly.

makeReadWrite()

Makes control writable.

on()

Adds an event to the control and transfers an array of arguments to the handler.

removeClass()

Removes the from the control.

removeValidation()

Removes validation from the control.

reset()

Sets the control value to the original one.

setDisabled()

Makes the control "disabled".

setEnabled()

Makes the control "enabled".

setFocus()

Sets focus to the control.

setValue()

Sets the control value.

show()

Shows the control.

validate()

Validates the control.

validateAs()

Validates the control value for some validation type.

Events

Event name

Description

blur

An element loses focus.

change

The user changes the content of a field.

click

Mouse clicks an object.

dblclick

Mouse double-clicks an object.

focus

An element gets focus.

keydown

A keyboard key is pressed.

keypress

A keyboard key is pressed or held down.

keyup

A keyboard key is released.

mousedown

A mouse button is pressed.

mousemove

The mouse is moved.

mouseout

The mouse is moved off the element.

mouseover

The mouse is moved over an element.

mouseup

A mouse button is released.

resize

A window or frame is resized.

select

Text is selected.

Control object examples:

Ask for confirmation before saving a record

Change font in dropdown list

Change font in "edit" controls

Change width of edit box with AJAX popup

Change width of text field on Quick Search panel

How to calculate values (totals) on the fly

How to control Inline Add/Edit functionality from script

How to hide 'Edit selected'/'Delete selected' buttons

Show dropdown list of US states if US was selected in country list

See also:

JavaScript API: Control object > addValidation()

About JavaScript API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software