Introduced PasswordField.class.php to keep things simple.
[timetracker.git] / WEB-INF / lib / form / TextArea.class.php
index 9cfd431..728f462 100644 (file)
 import('form.FormElement');
        
 class TextArea extends FormElement {
-    var $mValue;
     var $mPassword     = false;
     var $mColumns      = "";
     var $mRows         = "";
-    var $cClassName            = "TextArea";
+    var $class = 'TextArea';
+    var $mOnKeyPress   = "";
 
-       function TextArea($name,$value="")
+       function __construct($name,$value="")
        {
-               $this->mName                    = $name;
-               $this->mValue                   = $value;
+               $this->name = $name;
+               $this->value = $value;
        }
        
        function setColumns($value)     { $this->mColumns = $value;     }
@@ -47,15 +47,14 @@ class TextArea extends FormElement {
        function setRows($value)        { $this->mRows = $value;        }
        function getRows()      { return $this->mRows; }
        
-       function toStringControl()      {
-               if (!$this->isRenderable()) return "";
-           
-           if ($this->mId=="") $this->mId = $this->mName;
+       function getHtml() {
+    
+           if ($this->id=="") $this->id = $this->mName;
            
            $js_maxlen = "";
            
                $html = "\n\t<textarea";
-               $html .= " name=\"$this->mName\" id=\"$this->mId\"";
+               $html .= " name=\"$this->name\" id=\"$this->id\"";
                
                if ($this->mColumns!="")
                  $html .= " cols=\"$this->mColumns\"";
@@ -63,15 +62,15 @@ class TextArea extends FormElement {
                if ($this->mRows!="")
                   $html .= " rows=\"$this->mRows\"";
                   
-               if ($this->mMaxLength!="") {
+               if ($this->max_length!="") {
                        if ($this->mOnKeyPress) $this->mOnKeyPress .= ";";
-                       $this->mOnKeyPress .= "return validateMaxLenght_".$this->mName."(this, event);";
+                       $this->mOnKeyPress .= "return validateMaxLenght_".$this->name."(this, event);";
                        $js_maxlen = $this->getExtraScript();
-                       $html .= " maxlength=\"$this->mMaxLength\"";
+                       $html .= " maxlength=\"$this->max_length\"";
                }
 
-               if ($this->mStyle!="")
-                  $html .= " style=\"$this->mStyle\"";
+               if ($this->style!="")
+                  $html .= " style=\"$this->style\"";
 
                if ($this->mOnKeyPress) {
                        $html .= " onkeypress=\"$this->mOnKeyPress\"";
@@ -86,8 +85,8 @@ class TextArea extends FormElement {
        function getExtraScript() {
                $s = "<script>\n";
                $s .= "var isNS4 = (navigator.appName==\"Netscape\")?1:0;\n";
-               $s .= "function validateMaxLenght_".$this->mName."(element, event) {\n";
-               $s .= "\tmaxlength=".$this->mMaxLength.";\n";
+               $s .= "function validateMaxLenght_".$this->name."(element, event) {\n";
+               $s .= "\tmaxlength=".$this->max_length.";\n";
                $s .= "\tvar iKey = (!isNS4?event.keyCode:event.which);\n";
                //$s .= "alert(iKey);";
                $s .= "\tvar re = new RegExp(\"".'\r\n'."\",\"g\");\n";
@@ -101,4 +100,3 @@ class TextArea extends FormElement {
                return $s;
        }
 }
-?>
\ No newline at end of file