Commit 0fa8410
committed
Bug where one radio button in group required
The HTML spec does not seemd to clearly state what "required" does when
only some of a radio button set are required.
This answer on StackOverflow states that only one of the set is
required: http://stackoverflow.com/a/8287947/1009332
Per the comments added in the fix:
We cannot just compare allInputs for radio buttons, as the spec for required radio buttons
states that only one of a radio button set needs to be required.
If you have 2 radio buttons, and one is checked, but it's not required, then we get
the other required radio button and see that there are no other radio buttons checked
for the "required" ones.
Thus, if the input control is a radio button, then filter for all radio buttons with
the same name on the form.
This will get all radio buttons of a given name that are checked and see that at
least one is checked. Don't count unchecked required radio if other radio with same
name is checked. But do count checked non-required radio of the same name.
Note, each radio button name that is required is checked only once.1 parent 15515b2 commit 0fa8410
2 files changed
+61
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
317 | 322 | | |
318 | | - | |
319 | | - | |
| 323 | + | |
320 | 324 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
325 | 339 | | |
326 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
327 | 348 | | |
328 | 349 | | |
329 | | - | |
| 350 | + | |
330 | 351 | | |
331 | 352 | | |
332 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
278 | 303 | | |
279 | 304 | | |
280 | 305 | | |
| |||
0 commit comments