diff --git a/form.php b/form.php index 081df3f..9955638 100644 --- a/form.php +++ b/form.php @@ -257,6 +257,16 @@ class form $this->method = strtolower ($method); $res = ""; $res = "
fields as $field) + { + if ($field->type === "file") + { + $res .= "enctype='multipart/form-data'"; + break; + } + } if ($this->formName != "") $res .= " id='$this->formName'"; $res .= " class='".$this->formClass."'>\n"; @@ -572,7 +582,7 @@ class formfield */ public function hidden ($val) { - $this->type = !! $val; + $this->hidden = !! $val; return $this; } @@ -1247,4 +1257,86 @@ class formfield $res .= " \n"; // End form-group return $res; } + + /** Return the file defined */ + public function fieldfile () + { + $res = ""; + // No $this->multiple, $this->titles, $this->rows, $this->cols + $res .= "
\n"; + if ($this->label !== "") + { + $res .= " \n"; + } + $res .= "
\n"; + if (isset ($this->defaults)) + { + $res .= " \n"; // End labels + if (isset ($this->errors) || isset ($this->help)) + { + $res .= " "; + if (isset ($this->help)) + $res .= "".$this->help.""; + if (isset ($this->help) && isset ($this->errors)) + $res .= "
"; + if (isset ($this->errors)) $res .= $this->errors[1]; + $res .= "
\n"; + } + + $res .= "
\n"; // End controls + $res .= "
\n"; // End form-group + return $res; + } }