Commit 62356989 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Pass the form to the validation function so it can set errors on the

form, and made the set_error method public for the same reason. Removed
a debug line.
parent 67e34eca
......@@ -189,7 +189,7 @@ class Form {
// Then user specific validation if a function is available for that
$function = $this->name . '_validate';
if (function_exists($function)) {
$function($values);
$function($this, $values);
}
// Submit the form if things went OK
......@@ -315,7 +315,7 @@ class Form {
/**
* Marks a field has having an error
*/
private function set_error($name, $message) {
public function set_error($name, $message) {
foreach ($this->elements as &$element) {
if ($element['type'] == 'fieldset') {
foreach ($element['elements'] as &$subelement) {
......@@ -380,7 +380,7 @@ class Form {
* This EXCLUDES the "value" attribute, as various form elements set
* their value in different ways.
*/
public static function element_attributes($element, $exclude=array()) {log_dbg($element);
public static function element_attributes($element, $exclude=array()) {
static $attributes = array('accesskey', 'class', 'dir', 'id', 'lang', 'maxlength', 'name', 'size', 'style', 'tabindex');
$elementattributes = array_diff($attributes, $exclude);
$result = '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment