Skip to content

Commit

Permalink
Merge pull request #118 from arturopala/APB-3378
Browse files Browse the repository at this point in the history
[APB-3378][MP,AO] Display only relevant errors of the composite date input
  • Loading branch information
rpowis authored Feb 12, 2019
2 parents 71b045b + 72a37f8 commit 6cff198
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@*
* Copyright 2018 HM Revenue & Customs
* Copyright 2019 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,9 @@
@import play.api.i18n._
@import uk.gov.hmrc.play.mappers.DateFormatSymbols._


@fieldNames = @{
Set(fieldName, s"${fieldName}.day", s"${fieldName}.month", s"${fieldName}.year")
}

@fieldsetClasses = @{if(formItem.hasErrors) "form-field--error" else "" }

Expand All @@ -36,7 +38,7 @@
@args.toMap.get('_inputHint).map { hint =>
<span class="form-hint">@hint</span>
}
@formItem.errors.map { error => <span class="error-notification">@Messages(error.message)</span>}
@formItem.errors.filter(error => fieldNames.contains(error.key)).map { error => <span class="error-notification">@Messages(error.message)</span>}
</legend>

@input(
Expand Down

0 comments on commit 6cff198

Please sign in to comment.