@@ -68,7 +68,8 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
"name" => "familyid",
"type" => "select",
"value" => $data["family"],
- "options" => $familylist
+ "options" => $familylist,
+ "error" => "Choose a family."
],
[
"label" => "Amount",
@@ -77,16 +78,17 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
"type" => "number",
"maxlength" => 5,
"value" => $data["amount"],
- "width" => 2
+ "width" => 2,
+ "error" => "Enter a dollar amount."
],
[
"label" => "Date",
"icon" => "fas fa-calendar",
"name" => "date",
"type" => "date",
- "maxlength" => 20,
"value" => $data["date"],
- "width" => 3
+ "width" => 3,
+ "error" => "Choose a date for the payment."
],
[
"label" => "Type",
@@ -102,7 +104,8 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
"Free" => "Free",
"Other" => "Other"
],
- "width" => 3
+ "width" => 3,
+ "error" => "Select a payment type."
]
];
@@ -124,6 +127,13 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
aria-label=""
maxlength=""
+ pattern=""
+
+
value=""
@@ -148,6 +158,9 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
+
+
+
@@ -194,7 +207,7 @@ if (!empty($_GET['id']) && $database->has('payments', ['paymentid' => $_GET['id'
?>
diff --git a/static/js/editfamily.js b/static/js/editfamily.js
index ed21c5b..f175a39 100644
--- a/static/js/editfamily.js
+++ b/static/js/editfamily.js
@@ -14,25 +14,6 @@ $("#add_child_row").click(function () {
});
});
-$("#editform").on("submit", function () {
- // Do some client-side validation that isn't handled by the browser
- var phone = $("input[name=phone]").val();
- var zip = $("input[name=zip]").val();
- var ok = true;
-
-
- if (/^[0-9]{10}$/.test(phone) == false) {
- ok = false;
- $("input[name=phone]").addClass()
- }
-
- if (/^[0-9]{5}(-?[0-9]{4})?$/.test(zip) == false) {
- ok = false;
- }
-
- return ok;
-});
-
$("#savebutton").click(function (event) {
var form = $("#editform");
diff --git a/static/js/editpayment.js b/static/js/editpayment.js
new file mode 100644
index 0000000..abfa584
--- /dev/null
+++ b/static/js/editpayment.js
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+$("#savebutton").click(function (event) {
+ var form = $("#editform");
+
+ if (form[0].checkValidity() === false) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ form.addClass('was-validated');
+});
\ No newline at end of file