setChecked Method

             

Sets the state of the Checkbox object.

Syntax

object.setChecked(value)

Parameters

Object

A Checkbox script object.

value

The value that is written to the database.

Remarks

The Checkbox object is often used for displaying and writing Boolean data to a database. However, it is not necessary to use data binding.

When data binding, the state of the Checkbox is mapped to the <INPUT> tag's VALUE attribute. The value that is written to the database upon submission of the form depends on the data type of the Recordset object's data field and the user's input.

You can pass a number of different types of arguments to set a Checkbox.

To get the state of the Checkbox, see the getChecked method.

Example

function btnCheck_onclick() 
{
   // Toggle the checked state of the checkbox when the user clicks btnCheck
   if (Checkbox1.getChecked() )
      Checkbox1.setChecked( 0 );      // param can be a number
   else
      Checkbox1.setChecked( "true" );    // or a string, or Boolean 
}