Commit e798fe83 authored by Steven Wittens's avatar Steven Wittens

form_checkbox() was totally broken: a checkbox needs a value on top of being...

form_checkbox() was totally broken: a checkbox needs a value on top of being (un)checked. When it is checked, the value is sent as "name=value". When not checked, nothing is sent. Usually a value of "1" will suffice, but I added explicit separate $value and $checked parameters to make sure no mix-up occurs, and to allow more freedom.
parent 148c23d3
......@@ -335,8 +335,8 @@ function form_item($title, $value, $description = 0) {
return ($title ? "<b>$title:</b><br />" : "") . $value . ($description ? "<br /><small><i>$description</i></small>" : "") ."<p />\n";
}
function form_checkbox($title, $name, $value, $description = 0) {
return form_item(0, "<input type=\"checkbox\" name=\"edit[$name]\" ". ($value ? " checked=\"checked\"" : "") ." /> $title", $description);
function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0) {
return form_item(0, "<input type=\"checkbox\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") ." /> $title", $description);
}
function form_textfield($title, $name, $value, $size, $maxlength, $description = 0) {
......
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