setup_element($a);
if ($a["type"]=="password")
$this->pass=1;
}
function self_get($val,$which, &$count) {
$str = "";
if (is_array($this->value))
$v = htmlspecialchars($this->value[$which]);
else
$v = htmlspecialchars($this->value);
$n = $this->name . ($this->multiple ? "[]" : "");
$str .= "pass)? " type='password'" : " type='text'";
if ($this->maxlength)
$str .= " maxlength='$this->maxlength'";
if ($this->size)
$str .= " size='$this->size'";
if ($this->extrahtml)
$str .= " $this->extrahtml";
$str .= ">";
$count = 1;
return $str;
}
function self_get_frozen($val,$which, &$count) {
$str = "";
if (is_array($this->value))
$v = $this->value[$which];
else
$v = $this->value;
$n = $this->name . ($this->multiple ? "[]" : "");
$str .= "\n";
$str .= "$v\n";
$count = 1;
return $str;
}
function self_get_js($ndx_array) {
$str = "";
reset($ndx_array);
while (list($k,$n) = each($ndx_array)) {
if ($this->length_e) {
$str .= "if (f.elements[${n}].value.length < $this->minlength) {\n";
$str .= " alert(\"Too short!\");\n";
$str .= " f.elements[${n}].focus();\n";
$str .= " return(false);\n}\n";
}
if ($this->valid_e) {
$flags = ($this->icase ? "gi" : "g");
$str .= "if (window.RegExp) {\n";
$str .= " var reg = new RegExp(\"$this->valid_regex\",\"$flags\");\n";
$str .= " if (!reg.test(f.elements[${n}].value)) {\n";
$str .= " alert(\"$this->valid_e\");\n";
$str .= " f.elements[${n}].focus();\n";
$str .= " return(false);\n";
$str .= " }\n}\n";
}
}
return $str;
}
function self_validate($val) {
if (!is_array($val)) $val = array($val);
reset($val);
while (list($k,$v) = each($val)) {
if ($this->length_e && (strlen($v) < $this->minlength))
if ($this->valid_minlength_error) {
return $this->valid_minlength_error;
} else {
return $this->valid_e;
}
if ($this->valid_e && (($this->icase &&
!eregi($this->valid_regex,$v)) ||
(!$this->icase &&
!ereg($this->valid_regex,$v))))
return $this->valid_e;
// new added by adigeo 2001-05-28
if ($this->valid_e2_error && (($this->icase &&
!eregi($this->valid_e2,$v)) ||
(!$this->icase &&
!ereg($this->valid_e2,$v))))
return $this->valid_e2_error;
}
return false;
}
} // end TEXT
?>