File: /home/imensosw/matrix.imenso.co/admin/admin_footer.php
<script type="text/javascript">
var isShift = false;
var seperator = "-";
window.onload = function () {
//Reference all INPUT elements in the Table.
var inputs = $(".date-format");
//Loop through all INPUT elements.
for (var i = 0; i < inputs.length; i++) {
//Check whether the INPUT element is TextBox.
if (inputs[i].type == "text") {
//Check whether Date Format Validation is required.
if (inputs[i].className.indexOf("date-format") != 1) {
var inputs = $(".date-format");
//Set Max Length.
inputs[i].setAttribute("maxlength", 10);
//Only allow Numeric Keys.
inputs[i].onkeydown = function (e) {
return IsNumeric(this, e.keyCode);
};
//Validate Date as User types.
inputs[i].onkeyup = function (e) {
ValidateDateFormat(this, e.keyCode);
};
}
}
}
};
function IsNumeric(input, keyCode) {
if (keyCode == 16) {
isShift = true;
}
//Allow only Numeric Keys.
if (((keyCode >= 48 && keyCode <= 57) || keyCode == 8 || keyCode <= 37 || keyCode <= 39 || (keyCode >= 96 && keyCode <= 105)) && isShift == false) {
if ((input.value.length == 2 || input.value.length == 5) && keyCode != 8) {
input.value += seperator;
}
return true;
}
else {
return false;
}
};
function ValidateDateFormat(input, keyCode) {
var dateString = input.value;
if (keyCode == 16) {
isShift = false;
}
var regex = /(((0|1)[0-9]|2[0-9]|3[0-1])\-(0[1-9]|1[0-2])\-((19|20)\d\d))$/;
//Check whether valid dd/MM/yyyy Date Format.
if (regex.test(dateString) || dateString.length == 0) {
ShowHideError(input, "none");
} else {
ShowHideError(input, "block");
}
};
function ShowHideError(textbox, display) {
var row = textbox.parentNode.parentNode;
var errorMsg = row.getElementsByTagName("span")[0];
if (errorMsg != null) {
errorMsg.style.display = display;
}
};
</script>
<footer class="footer-area border-top">
<div class="container-fluid d-flex h-100">
<div class="row justify-content-end align-self-center w-100">
<!-- <form class="form-inline" id="formAddRow" >-->
<!-- <input type="hidden" name="rowId" id="rowId">-->
<!-- <input type="hidden" name="docId" id="docId">-->
<!-- <label for="email">Title:</label>-->
<!-- <input type="text" class="form-control" name="title" id="title">-->
<!-- <label for="pwd">Date:</label>-->
<!-- <input type="text" class="form-control date-format" name="date" id="date">-->
<!-- <span class="error" style="display: none">Invalid Date.</span>-->
<!-- <label for="pwd">Description:</label>-->
<!-- <input type="text" class="form-control" id="description" name="description">-->
<!-- <button type="button" id="submit_button" name="submit" class="btn btn-primary">Submit</button>-->
<!--</form>-->
</div>
</div>
</footer>
</body>
</html>