|
41 | 41 | <div class="form-text">Tip: try starting your reason with a verb, e.g. <i>"Helped out at X event"</i>, <i>"Ranked 1st in Y"</i> or <i>"Received community service"</i>.</div> |
42 | 42 | </div> |
43 | 43 |
|
| 44 | + <script> |
| 45 | + // Watch for the word "event" in the reason field and display a warning if it is found |
| 46 | + document.getElementById('reason').addEventListener('input', function() { |
| 47 | + const reason = this.value.toLowerCase(); |
| 48 | + const warning = document.getElementById('reason-warning'); |
| 49 | + if (reason.includes('event')) { |
| 50 | + if (!warning) { |
| 51 | + const warningDiv = document.createElement('div'); |
| 52 | + warningDiv.id = 'reason-warning'; |
| 53 | + warningDiv.classList.add('form-text', 'text-danger'); |
| 54 | + warningDiv.innerText = 'It seems you are trying to assign points for an event. Please use the event-specific forms instead (see warning at the top of the page).'; |
| 55 | + this.parentNode.appendChild(warningDiv); |
| 56 | + } |
| 57 | + } else { |
| 58 | + if (warning) { |
| 59 | + warning.remove(); |
| 60 | + } |
| 61 | + } |
| 62 | + }); |
| 63 | + </script> |
| 64 | + |
44 | 65 | <button type="submit" class="btn btn-primary">Assign single score</button> |
45 | 66 | </form> |
46 | 67 |
|
@@ -75,6 +96,27 @@ login3,-1000,A very solid reason" required></textarea> |
75 | 96 | }); |
76 | 97 | </script> |
77 | 98 |
|
| 99 | + <script> |
| 100 | + // Watch for the word "event" in the csv field and display a warning if it is found |
| 101 | + document.getElementById('csv').addEventListener('input', function() { |
| 102 | + const csv = this.value.toLowerCase(); |
| 103 | + const warning = document.getElementById('reason-warning-csv'); |
| 104 | + if (csv.includes('event')) { |
| 105 | + if (!warning) { |
| 106 | + const warningDiv = document.createElement('div'); |
| 107 | + warningDiv.id = 'reason-warning-csv'; |
| 108 | + warningDiv.classList.add('form-text', 'text-danger'); |
| 109 | + warningDiv.innerText = 'It seems you are trying to assign points for an event. Please use the event-specific forms instead (see warning at the top of the page).'; |
| 110 | + this.parentNode.appendChild(warningDiv); |
| 111 | + } |
| 112 | + } else { |
| 113 | + if (warning) { |
| 114 | + warning.remove(); |
| 115 | + } |
| 116 | + } |
| 117 | + }); |
| 118 | + </script> |
| 119 | + |
78 | 120 | <button type="submit" class="btn btn-primary">Assign multiple scores</button> |
79 | 121 | </form> |
80 | 122 |
|
|
0 commit comments