Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc |
— | — | @@ -87,6 +87,25 @@ |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
| 91 | +function validate_mandatory_checkboxes(field_id, info_id) { |
| 92 | + elems = document.getElementsByTagName("*"); |
| 93 | + var all_fields_unchecked = true; |
| 94 | + for (var i = 0; i < elems.length; i++) { |
| 95 | + if (elems[i].id == field_id) { |
| 96 | + if (elems[i].checked) { |
| 97 | + all_fields_unchecked = false; |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + if (all_fields_unchecked) { |
| 102 | + infobox = document.getElementById(info_id); |
| 103 | + infobox.innerHTML = "$blank_error_str"; |
| 104 | + return false; |
| 105 | + } else { |
| 106 | + return true; |
| 107 | + } |
| 108 | +} |
| 109 | + |
91 | 110 | // validate a mandatory field that exists across multiple instances of |
92 | 111 | // a template - we have to find each one, matching on the pattern of its |
93 | 112 | // ID, and validate it |