mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
4499d1a8d0
commit
fbabb9b31f
@ -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 = '';
|
||||
|
Loading…
Reference in New Issue
Block a user