Commit e97c3abd authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

A checkbox that really actually works ....

parent 177187f1
......@@ -50,4 +50,26 @@ function pieform_element_checkbox(Pieform $form, $element) {
. '>';
}
function pieform_element_checkbox_get_value(Pieform $form, $element) {
$name = $element['name'];
$global = ($form->get_property('method') == 'get') ? $_GET : $_POST;
if (isset($element['value'])) {
return $element['value'];
}
if ($form->is_submitted()) {
if(isset($global[$name])) {
return true;
}
return false;
}
if (isset($element['defaultvalue'])) {
return $element['defaultvalue'];
}
return false;
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment