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) {
// 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;
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;
}