Returns an error message (if any) that should be used when displaying the form.

@param string $field

@return null|string
481014
public function error($field)
    {
        return ($this->submitted && isset($this->errors[$field])) ? $this->errors[$field] : null;
    }
260109
public function inError(string $field): bool
    {
        foreach ($this->_errors as $item) {
            if ($field === $item['name']) {
                return true;
            }
        }
        return false;
    }
435232
public function getField($field)
    {
        // Skip invalid fields
        $fields = $this->compositeDatabaseFields();
        if (!isset($fields[$field])) {
            return null;
        }

        // Check bound object
        if ($this->record instanceof DataObject) {
            $key = $this->getName() . $field;
            return $this->record->getField($key);
        }

        // Check local record
        if (isset($this->record[$field])) {
            return $this->record[$field];
        }
        return null;
    }
166856
public function get_error_message($field, $value, $validator) {
		return $validator->get_label($field) . ' must match ' . $validator->get_label($this->compare_against);
	}
1142127
protected function get($field)
    {
        $map = $this->_config['fieldMap'];
        if (isset($map[$field])) {
            $field = $map[$field];
        }

        if (isset($this->data[$field])) {
            return $this->data[$field];
        }

        return null;
    }
1054878
public function email($field)
    {
        return (filter_var(trim($this->get($field)), FILTER_VALIDATE_EMAIL) !== false) ?: $this->error($field,
            __FUNCTION__);
    }
655674
public function getValFormatted($field)
    {
        $val = $field->valRaw();
        if (\preg_match('|^(\d{3})[\. -]?(\d{2})[\. -]?(\d{4})$|', $val, $matches)) {
            list($area, $group, $serial) = \array_slice($matches, 1);
            return $area.'-'.$group.'-'.$serial;
        }
        return null;
    }
728669
public function getErrorTemplate(string $field, string $ruleSlug) : string
    {
        if (isset($this->fieldTemplates[$field][$ruleSlug])) {
            return $this->fieldTemplates[$field][$ruleSlug];
        }

        if (isset($this->globalTemplates[$ruleSlug])) {
            return $this->globalTemplates[$ruleSlug];
        }

        return '';
    }
400093
public function digit($field)
    {
        return (ctype_digit((string)$this->get($field)) === true) ?: $this->error($field, __FUNCTION__);
    }
46846
protected function get_field($field) {
        $fieldname = calculator::using_attempts_string_id($this->whichattempts).$field;
        return $this->{$fieldname};
    }
440470
public function getMaxLength($field)
    {
        $parts = explode('.', $field);
        $validator = $this->_getValidator($parts);
        $fieldName = array_pop($parts);
        if (!$validator->hasField($fieldName)) {
            return null;
        }
        foreach ($validator->field($fieldName)->rules() as $rule) {
            if ($rule->get('rule') === 'maxLength') {
                return $rule->get('pass')[0];
            }
        }

        return null;
    }
75674
function errorrenderer($fieldtype = null) {
		$fieldtype !== null or $fieldtype = 'field';
		if ($this->errorrenderers !== null) {
			if (isset($this->errorrenderers[$fieldtype])) {
				return $this->errorrenderers[$fieldtype];
			}
			else if (isset($this->errorrenderers['field'])) {
				return $this->errorrenderers['field'];
			}
		}

		// hard default: do not display errors
		return function (array $errors = null) { return ''; };
	}
684982
public function getField(string $field)
    {
        if (isset($this->_record[$field]))
            return $this->_record[$field];
        return null;
    }
689318
public function getErrors(string $field) : array
    {
        $compiledErrors = [];

        foreach ($this->errorSlugsAndPlaceholders as $errorData) {
            $compiledErrors[] = $this->errorTemplateCompiler->compile(
                $field,
                $this->errorTemplateRegistry->getErrorTemplate($field, $errorData['slug']),
                $errorData['placeholders']
            );
        }

        return $compiledErrors;
    }
579696
public function getInvalidField($field)
    {
        $value = isset($this->_invalid[$field]) ? $this->_invalid[$field] : null;

        return $value;
    }
1510
protected function _nestedErrors($field)
    {
        $path = explode('.', $field);

        // Only one path element, check for nested entity with error.
        if (count($path) === 1) {
            return $this->_readError($this->get($path[0]));
        }

        $entity = $this;
        $len = count($path);
        while ($len) {
            $part = array_shift($path);
            $len = count($path);
            $val = null;
            if ($entity instanceof EntityInterface) {
                $val = $entity->get($part);
            } elseif (is_array($entity)) {
                $val = isset($entity[$part]) ? $entity[$part] : false;
            }

            if (is_array($val) ||
                $val instanceof Traversable ||
                $val instanceof EntityInterface
            ) {
                $entity = $val;
            } else {
                $path[] = $part;
                break;
            }
        }
        if (count($path) <= 1) {
            return $this->_readError($entity, array_pop($path));
        }

        return [];
    }
472686
final public function getRowFieldValue($field)
    {

        //If value exists;
        if (array_key_exists($field, $this->schema)) {
            return $this->schema[$field]->Value;
        }
        return null;
    }