InputfieldCheckbox class

Single checkbox toggle

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the InputfieldCheckbox class also inherits all the methods and properties of: Inputfield, WireData and Wire.

Show class?             Show args?        

Common

NameReturnSummary 
autocheck int When set to 1, setting value attribute to non-blank/non-zero automatically triggers checked.  
checkboxLabel string Same as label2, but used as part of field config rather than API-only config. 
checkboxOnly bool Show only the checkbox without label text next to it? (default=false) @since 3.0.144 
checked()
boolGet or set current checkbox boolean attribute state 
checkedValue string Value when checked (default=1) 
getConfigInputfields()
InputfieldWrapperConfigure checkbox field
isEmpty()
boolIs empty (checkbox not checked)? 
label2 string Alterate label to display next to checkbox (default=use regular label) 
labelAttrs array Optional attributes for <label> element that surrounds checkbox (default=[]) @since 3.0.141 
processInput(WireInputData $input)
$thisProcess input
render()
stringRender checkbox input
renderValue()
stringRender value only
set(string $key, mixed $value)
InputfieldCheckbox InputfieldSet property 
setAttribute($key, $value)
Inputfield InputfieldCheckboxSet attribute 
uncheckedValue string Value when not checked (default='', blank string) 
wired()
(nothing)Wired to ProcessWire instance 

Additional methods and properties

In addition to the methods and properties above, InputfieldCheckbox also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.244

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull