InputfieldCheckbox::checked() method

Get or set current checkbox boolean attribute state

Available since version 3.0.133.

Example

// the following two lines are equivalent to GET checkbox state
$checked = $f->checked();
$checked = !empty($f->attr('checked'));

// the following two lines are equivalent to SET checkbox state
$f->checked(true);
$f->attr('checked', 'checked'); 

Usage

// basic usage
$bool = $inputfieldCheckbox->checked();

// usage with all arguments
$bool = $inputfieldCheckbox->checked($checked = null);

Arguments

NameType(s)Description
checked (optional)

Return value

bool


InputfieldCheckbox methods and properties

API reference based on ProcessWire core version 3.0.244

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer