Contents

 
Home
PHPRunner 7.1 manual
Prev Page Next Page
 
 

Javascript API: Control object

 

Control object allows you to work with the "edit" controls. Control object is available in the Javascript OnLoad event of the appropriate page.

Before you start working with the "edit" controls, you need to get that controls. Use .getControl() method to get controls by the field name and page id:

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

Example:

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

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

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

Example:

// Get all the controls for the table 'Cars'
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 and if the control was not previously validated removes the message that it was not validated.

clearEvent()

Deletes events.

getDispElem()

Returns 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 transfer the array of arguments to the handler.

removeClass()

Removes the class from the control.

removeValidation()

Removes validation from the control.

reset()

Sets the control value to the original one.

setDisabled()

Makes control "disabled".

setEnabled()

Makes 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 an 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.

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 access PHP variables

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

How to work with foldable section

How to work with tabs

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

 

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)