Skip to content

Commit

Permalink
Merge pull request #379 from codeconsole/6.0.x
Browse files Browse the repository at this point in the history
Merge 5.1.x
  • Loading branch information
codeconsole authored Nov 7, 2024
2 parents 4e665af + f3f98d9 commit 6424074
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,16 @@ class FormFieldsTagLib {
}
}

List classes = [widgetAttrs['class'] ?: '']
if (model.invalid) classes << (widgetAttrs.remove('invalidClass') ?: '')
if (model.required) classes << (widgetAttrs.remove('requiredClass') ?: '')
widgetAttrs['class'] = classes.join(' ').trim()
List widgetClasses = [widgetAttrs['class'] ?: '']
String cssClass = widgetAttrs.remove('invalidClass')
if (cssClass && model.invalid) {
widgetClasses << cssClass
}
cssClass = widgetAttrs.remove('requiredClass')
if (cssClass && model.required) {
widgetClasses << cssClass
}
widgetAttrs['class'] = widgetClasses.join(' ').trim()
if (widgetAttrs['class'].isEmpty()) {
widgetAttrs.remove('class')
}
Expand Down

0 comments on commit 6424074

Please sign in to comment.