Please enable JavaScript to view this site.

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

JavaScript API: Control object > getValue()

Scroll Prev Next More

 

Reads the control value.

Syntax

var value = ctrl.getValue();

Arguments

No arguments.

Return value

Returns the current value of the control.

Example1

Read the control value using the JavaScript OnLoad event:

 

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

Example2

Show an alert if the checkbox control is checked using the JavaScript OnLoad event:

 

var ctrl = Runner.getControl(pageid, 'Discounted');
if (ctrl.getValue()=='on')
  alert('Checked');
 
// you can use the setValue function to clear the checkbox:
ctrl.setValue('');

See also:

JavaScript API: Control object > getControl()

JavaScript API: Control object > setValue()

JavaScript API: Control object > reset()

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

Event: JavaScript OnLoad

JavaScript API: Control object

JavaScript API