diff --git a/class/boolfield.php b/class/boolfield.php new file mode 100644 index 0000000000000000000000000000000000000000..eac09b660c49a6e6e9ddbbc335397a41f2785f96 --- /dev/null +++ b/class/boolfield.php @@ -0,0 +1,21 @@ +<? +class BoolField extends Field +{ + + public function html() { + $html = '<div class = "form-group"> + <label for = "form'.$this->name.'">'.ucfirst($this->name).'</label> + <input type = "checkbox" class="form-control" name = "'.$this->name.'" value ="'.$this->value.'"> + </div>'; + return $html; + } + + public function validate() + { + $this->value = $POST[$this->name]; + if (!is_bool($this->value)) + return false; + return true; + } +} + diff --git a/class/field.php b/class/field.php index e94ef3f1f3f259859585869db7b6b2a18fb4855e..283fdbe60274a6330ae28832127fbfac0c243b31 100644 --- a/class/field.php +++ b/class/field.php @@ -26,20 +26,3 @@ class Field { } } - -class BoolField extends Field -{ - public function __construct($name, &$value) - { - parent::__construct($name, &$value); - } - - public function validate() - { - $this->value = $POST[$this->name]; - if (!is_bool($this->value)) - return false; - return true; - } -} -