File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
NHSUKViewComponents.Web/Views/Shared/Components/RadioList Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 4444
4545 @if (Model .Required && ! Model .HasError )
4646 {
47- <div data-valmsg-for =" @Model.AspFor" data-valmsg-replace =" true" class =" error-message--margin-bottom-1 nhsuk-error-message field-validation-valid nhsuk-u-padding-top-1 nhsuk-u-padding-bottom-3" >
47+ <div data-valmsg-for =" @Model.AspFor" data-valmsg-replace =" true" class =" error-message--margin-bottom-1 nhsuk-error-message field-validation-valid nhsuk-u-padding-top-1 nhsuk-u-padding-bottom-3" aria-live = " assertive " role = " alert " >
4848 </div >
4949 }
5050
131131
132132 </div >
133133 </fieldset >
134+ <script >
135+ window .onload = function () {
136+ const id = " @Model.AspFor" ;
137+ const radioForm = document .querySelector (" main form[novalidate='novalidate']" );
138+ radioForm .addEventListener (" submit" , () => {
139+ const errorMessageParent = document .querySelector (" div[data-valmsg-for='" + id + " ']" );
140+ const errorMessage = errorMessageParent .innerHTML ;
141+ errorMessageParent .innerHTML = " " ;
134142
143+ setTimeout (function () {
144+ errorMessageParent .innerHTML = errorMessage;
145+ }, 0 );
146+ });
147+ };
148+ </script >
135149</div >
You can’t perform that action at this time.
0 commit comments