#138 function validate in tpl_form.inc always return false

current_CVS
open
nobody
OOH Forms (8)
5
2006-03-15
2006-03-15
CArlos Tineo
No

I work session4 with session4_custom, php4, postgreSQL 7.4

file tpl_form.inc (version stable/CVS) function validate()
always return false.

original:
function validate() {
global $form_name;
if (! is_object($this->form_data)) {
$this->setup();
}
if ($form_name == $this->classname) {
$err = $this->form_data->validate("ok");
if ($err == "ok") {
return $this->validate_input();
} else {
$this->error = $err;
return false;
}
} else {
return false;
}

The var global "$form_name" it's lost in some place,
its always is "".

I fixed with:
function validate() {
if (! is_object($this->form_data)) {
$this->setup();
}
if ($_POST["form_name"] == $this->classname) {
$err = $this->form_data->validate("ok");
if ($err == "ok") {
return $this->validate_input();
} else {
$this->error = $err;
return false;
}
} else {
return false;
}
}

Discussion