ENHANCEMENT Added CSS class "validationerror" to Form markup with validation errors. This makes it easy to evaluate a new form after an ajax call and give the user feedback independent of the form rendering, e.g. in ModelAdmin

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73030 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-03-13 10:19:10 +00:00
parent 4499d1a8d0
commit fbabb9b31f

View File

@ -506,6 +506,10 @@ class Form extends RequestHandler {
$attributes['enctype'] = $this->FormEncType();
if($this->target) $attributes['target'] = $this->target;
if($this->extraClass()) $attributes['class'] = $this->extraClass();
if($this->validator->getErrors()) {
if(!isset($attributes['class'])) $attributes['class'] = '';
$attributes['class'] .= ' validationerror';
}
// implode attributes into string
$preparedAttributes = '';