Skip to content
Everett Griffiths edited this page Jun 3, 2014 · 4 revisions

Checkbox

Syntax: checkbox(string $name, string $default=0, array $args=array(), string $tpl=null)

A standard checkbox will pass either a 1 or 0 value:

<?php Form::checkbox('mycheckbox', 1); ?>

If you want to pass values other than 1 and 0, then pass "checked_value" and "unchecked_value" as arguments:

<?php Form::checkbox('mycheckbox', 'Yes', array('checked_value'=>'Yes','unchecked_value'=>'No')); ?>

Checkbox fields pair a hidden field with a checkbox field to support the unchecked and checked value, respectively.