-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnew_member_process.php
64 lines (55 loc) · 2.26 KB
/
new_member_process.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php require_once("app.php");
$auth = new Authenticator();
$auth->requireMemberOf('board');
$board_members = $ldap->getGroupMembers("board");
if ($board_members === false) {
die('Unable to retrieve board members from LDAP');
}
$board_members = array_map(function($el){
return($el["cn"][0]);
}, $board_members);
echo($template["header"]);
?>
<div class="row"><div class="col-sm-2"></div><div class="col-sm-8">
<div class="row">
<div>
<h1>Submit a New Member Application</h1>
</div>
</div>
<form name="application_form" class="form-horizontal" action="new_member_process_submit.php" method="POST">
<?php
TemplateEngine::generateFormInput("name", "text", "Full Name", true);
TemplateEngine::generateFormInput("phone", "tel", "Phone", true);
TemplateEngine::generateFormInput("emergency_name", "text", "Emergency Contact Name", true);
TemplateEngine::generateFormInput("emergency_phone", "tel", "Emergency Contact Phone", true);
TemplateEngine::generateFormInput("username", "text", "Desired Username", true);
TemplateEngine::generateFormInput("donation", "number", "Monthly Donation", true, 1);
TemplateEngine::generateFormInput("email", "email", "Email Address", true);
TemplateEngine::generateFormInput("board1", "select", "Board Sponsor #1", true, $board_members);
TemplateEngine::generateFormInput("board2", "select", "Board Sponsor #2", true, $board_members);
TemplateEngine::generateFormInput("pronoun", "radio", "Desired Pronoun", true, array("his", "her", "other"));
TemplateEngine::generateFormSubmit("Submit");
?>
</form>
<script type="text/javascript">
var board2 = document.forms["application_form"]["board2"];
board2.setAttribute("onchange", "checkValid()");
var board1 = document.forms["application_form"]["board1"];
board1.setAttribute("onchange", "checkValid()");
board1.setCustomValidity("");
function checkValid() {
var board2_element = document.forms["application_form"]["board2"];
var board1 = document.forms["application_form"]["board1"].value;
var board2 = board2_element.value;
if (board1 == board2) {
board2_element.setCustomValidity("Board members must be different");
return false;
} else {
board2_element.setCustomValidity("");
return true;
}
}
checkValid();
</script>
</div>
<?php echo($template["footer"]); ?>