X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/30470a2fe679c83c29259328c5ad60a32ce69d3d..2df0ec3f98d0fa23102dc8362c4272ddebecf157:/WEB-INF/lib/form/Form.class.php diff --git a/WEB-INF/lib/form/Form.class.php b/WEB-INF/lib/form/Form.class.php index 14680db4..0fcbd620 100644 --- a/WEB-INF/lib/form/Form.class.php +++ b/WEB-INF/lib/form/Form.class.php @@ -38,27 +38,19 @@ class Form { var $name = ''; // TODO: refactoring ongoing down from here. - var $mMethod = "post"; - var $mEnctype = ""; - var $mId = ""; var $error; var $debugFunction; var $mElements = array(); var $mRequest; -// var $mFormBean; - function __construct($formid) { - $this->name = $formid; + function __construct($formName) { + $this->name = $formName; } function setRequest(&$request) { $this->mRequest = &$request; } - -/* function setFormBean(&$bean) { - $this->mFormBean = &$bean; - } -*/ + function &getElement($name) { return $this->mElements[$name]; } @@ -74,15 +66,8 @@ class Form { // name // onsubmit // onreset - function setName($value) { $this->name = $value; } function getName() { return $this->name; } - function setId($value) { $this->mId = $value; } - function getId() { return $this->mId; } - - function setMethod($value) { $this->mMethod = $value; } - function getMethod() { return $this->mMethod; } - function isSubmit() { if (!isset($this->mRequest)) return false; $result = false; @@ -256,22 +241,16 @@ class Form { function toStringOpenTag() { $html = "
name\""; - if ($this->mId!="") - $html .= " id=\"$this->mId\""; - - if ($this->mMethod!="") - $html .= " method=\"$this->mMethod\""; + $html .= ' method="post"'; - // for upload forms + // Add enctype for file upload forms. foreach ($this->mElements as $elname=>$el) { - if (strtolower(get_class($this->mElements[$elname]))=="uploadfile") { - $this->mEnctype = "multipart/form-data"; + if (strtolower(get_class($this->mElements[$elname])) == 'uploadfile') { + $html .= ' enctype="multipart/form-data"'; + break; } } - - if ($this->mEnctype!="") - $html .= " enctype=\"$this->mEnctype\""; - + $html .= ">"; return $html; }