|
29 | 29 | // Request Account Form was Submitted |
30 | 30 | if (count($errors) == 0) { |
31 | 31 | if ($_POST["new_user_sel"] == "pi") { |
| 32 | + if (!isset($_POST["chk_pi"]) || $_POST["chk_pi"] != "agree") { |
| 33 | + // checkbox was not checked |
| 34 | + array_push($errors, "Please confirm you have read the account policy guidelines."); |
| 35 | + } |
32 | 36 | // requesting a PI account |
33 | 37 | $USER->getPIGroup()->requestGroup($SEND_PIMESG_TO_ADMINS); |
34 | 38 | } elseif ($_POST["new_user_sel"] == "not_pi") { |
|
94 | 98 |
|
95 | 99 | <hr> |
96 | 100 |
|
97 | | - <label><input type='radio' name='new_user_sel' value='pi'>Request a PI account (I am a PI)</label> |
| 101 | + <label><input type='radio' name='new_user_sel' value='pi'>Request a PI account</label> |
| 102 | + <div style='position: relative;display: none;' id='piConfirmWrapper'> |
| 103 | + <label><input type='checkbox' id='chk_pi' name='confirm_pi' value='agree' required> |
| 104 | + I have read the PI <a href="<?php echo $CONFIG["site"]["account_policy_url"]; ?>"> |
| 105 | + account policy</a> guidelines. </label> |
| 106 | + </div> |
98 | 107 | <br> |
99 | 108 | <label><input type='radio' name='new_user_sel' value='not_pi' checked>Join an existing PI group</label> |
100 | 109 |
|
|
126 | 135 |
|
127 | 136 | <script> |
128 | 137 | $('input[type=radio][name=new_user_sel]').change(function() { |
| 138 | + let pi_cnf_text = $('#piConfirmWrapper'); |
129 | 139 | let pi_sel_text = $('#piSearchWrapper'); |
130 | 140 | if (this.value == 'not_pi') { |
| 141 | + pi_cnf_text.hide(); |
131 | 142 | pi_sel_text.show(); |
| 143 | + $("#chk_pi").prop("required", false); |
132 | 144 | $("#pi_search").prop("required", true); |
133 | 145 | } else if (this.value == 'pi') { |
| 146 | + pi_cnf_text.show(); |
134 | 147 | pi_sel_text.hide(); |
| 148 | + $("#chk_pi").prop("required", true); |
135 | 149 | $("#pi_search").prop("required", false); |
136 | 150 | } |
137 | 151 | }); |
|
0 commit comments