Added predefined expense selector onto the expenses.php page.
[timetracker.git] / WEB-INF / lib / form / Form.class.php
index 4d6987f..0fcbd62 100644 (file)
@@ -38,15 +38,13 @@ class Form {
   var $name = '';
   // TODO: refactoring ongoing down from here.
 
-       var $mEnctype      = "";
-       var $mId           = "";
     var $error;
        var $debugFunction;
        var $mElements     = array();
        var $mRequest;
     
-    function __construct($formid) {
-        $this->name = $formid;
+    function __construct($formName) {
+        $this->name = $formName;
     }
     
     function setRequest(&$request) {
@@ -68,12 +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 isSubmit()        {
        if (!isset($this->mRequest)) return false;
         $result = false;
@@ -247,21 +241,16 @@ class Form {
        function toStringOpenTag() {
         $html = "<form name=\"$this->name\"";
         
-        if ($this->mId!="") 
-            $html .= " id=\"$this->mId\"";
-            
         $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;
     }