4
4
@model RadiosViewModel
5
5
@{
6
6
int counter = 0 ;
7
-
7
+
8
8
}
9
9
10
10
<div class =" nhsuk-form-group @(Model.HasError ? " nhsuk-form-group--error " : " " )" >
60
60
< div class = " @Model.Class" >
61
61
< div class = " nhsuk-radios__item" >
62
62
< input class = " nhsuk-radios__input"
63
- id = " @radioId"
64
- name = " @Model.AspFor"
65
- type = " radio"
66
- value = " @radio.Value"
67
- aria - describedby = " @radio.Value-item-hint"
68
- data - val - required = " @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
69
- data - val = " @(Model.Required ? " true " : " false " )"
70
- @(radio .Selected ? " checked" : string .Empty ) / >
63
+ id = " @radioId"
64
+ name = " @Model.AspFor"
65
+ type = " radio"
66
+ value = " @radio.Value"
67
+ aria - describedby = " @(!string.IsNullOrEmpty( radio.HintText) ? $ " { radio . Value } - item - hint " : string.Empty) "
68
+ data - val - required = " @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
69
+ data - val = " @(Model.Required ? " true " : " false " )"
70
+ @(radio .Selected ? " checked" : string .Empty ) / >
71
71
< label class = " nhsuk-label nhsuk-radios__label" for = " @radioId" >
72
72
@radio .Label
73
73
< / label >
84
84
{
85
85
<div class =" nhsuk-radios__item" >
86
86
<input class =" nhsuk-radios__input"
87
- id =" @radioId"
88
- name =" @Model.AspFor"
89
- type =" radio"
90
- value =" @radio.Value"
91
- aria-describedby =" @radio.Value-item-hint"
92
- data-val-required =" @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
93
- data-val =" @(Model.Required ? " true " : " false " )"
94
- @(radio.Selected ? " checked" : string.Empty) />
87
+ id =" @radioId"
88
+ name =" @Model.AspFor"
89
+ type =" radio"
90
+ value =" @radio.Value"
91
+ aria-describedby =" @(!string.IsNullOrEmpty( radio.HintText) ? $ " {radio. Value} -item-hint" : string.Empty) "
92
+ data-val-required =" @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
93
+ data-val =" @(Model.Required ? " true " : " false " )"
94
+ @(radio.Selected ? " checked" : string.Empty) />
95
95
<label class =" nhsuk-label nhsuk-radios__label" for =" @radioId" >
96
96
@radio.Label
97
97
</label >
105
105
}
106
106
107
107
}
108
- @if (Model .OptionalRadio != null )
108
+ @if (Model .OptionalRadio != null )
109
109
{
110
110
<div class =" nhsuk-radios__divider nhsuk-u-padding-left-2" >or </div >
111
111
var radioId = $" {Model .OptionalRadio .Value }-{++ counter }" ;
112
112
<div class =" nhsuk-radios__item" >
113
113
<input class =" nhsuk-radios__input"
114
- id =" @radioId"
115
- name =" @Model.AspFor"
116
- type =" radio"
117
- value =" @Model.OptionalRadio.Value"
118
- aria-describedby =" @Model.OptionalRadio.Value-item-hint"
119
- data-val-required =" @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
120
- data-val =" @(Model.Required ? " true " : " false " )"
121
- @(Model.OptionalRadio.Selected ? " checked" : string.Empty) />
114
+ id =" @radioId"
115
+ name =" @Model.AspFor"
116
+ type =" radio"
117
+ value =" @Model.OptionalRadio.Value"
118
+ aria-describedby =" @(!string.IsNullOrEmpty( Model.OptionalRadio.HintText) ? $ " {Model.OptionalRadio. Value} -item-hint" : string.Empty) "
119
+ data-val-required =" @(Model.Required ? Model.RequiredClientSideErrorMessage : " " )"
120
+ data-val =" @(Model.Required ? " true " : " false " )"
121
+ @(Model.OptionalRadio.Selected ? " checked" : string.Empty) />
122
122
<label class =" nhsuk-label nhsuk-radios__label" for =" @radioId" >
123
123
@Model.OptionalRadio.Label
124
124
</label >
134
134
</div >
135
135
</fieldset >
136
136
137
- </div >
137
+ </div >
0 commit comments