Commit 7da2f2f
committed
prevent recheck of multiple radio buttons
bug detected when using validation "required" on group of radio buttons with same name attribute, i.e. "payment_method"
when not valid (i.e. no radio button was checked), an error message span would be created for each radio button element.
this patch adds a memory array named checkedInputs[]
to hold the names of elements that have been checked
during the iteration of isValid() func,
thereby preventing a recheck of elements with the same name,
in the situation of radio buttons.
during the iteration, each element is added to this array.
if the element name already exists in the array, the validation of that element will not be performed.
since each form element has unique names, except for radio buttons and checkbox groups, this does not affect other input types.
Important Notes on Multiple Checkboxes:
when using validation on a group of checkboxes,
set validation rule to checkboxes_group, and specify qty attribute, i.e. min1
otherwise the keyup event will trigger the validation on the checkbox,
without being able to read the other checkboxes in same named group,
and you will see an error message, even though the required qty of checkboxes is checked1 parent 1b99b52 commit 7da2f2f
1 file changed
+40
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
| |||
350 | 353 | | |
351 | 354 | | |
352 | 355 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
377 | 388 | | |
378 | 389 | | |
379 | 390 | | |
| |||
859 | 870 | | |
860 | 871 | | |
861 | 872 | | |
| 873 | + | |
862 | 874 | | |
863 | 875 | | |
864 | | - | |
| 876 | + | |
865 | 877 | | |
866 | 878 | | |
867 | | - | |
| 879 | + | |
868 | 880 | | |
869 | 881 | | |
870 | 882 | | |
| |||
0 commit comments