Alert boxes now functional for lack of both Currently Ongoing and End date and time.

This commit is contained in:
Russ 2015-04-07 19:30:58 -04:00
parent 1edb94620a
commit f3c866481c
2 changed files with 16 additions and 8 deletions

View File

@ -17,9 +17,17 @@ if( $_SESSION['access'] != 1 ) {
<script src="includes/js/dtp/jquery.datetimepicker.js"></script> <script src="includes/js/dtp/jquery.datetimepicker.js"></script>
<title>Add BMS Event</title> <title>Add BMS Event</title>
<script> <script>
$(function() { $(document).ready(function() {
$('#start_date_time').datetimepicker(); $('#start_date_time').datetimepicker();
$('#end_date_time').datetimepicker(); $('#end_date_time').datetimepicker();
$('#select_form').submit(function(event) {
if (!$("#is_ongoing").prop("checked") && $("#end_date_time").val() === "") {
alert('You must enter a value for Currently Ongoing or End Date and Time');
event.preventDefault();
return false;
}
});
}); });
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
@ -106,7 +114,7 @@ if( $_SESSION['access'] != 1 ) {
</div> </div>
<?php include "includes/classes/select.class.php";?> <?php include "includes/classes/select.class.php";?>
<br /> <br />
<form id="select_form" required method="post" action="includes/insert_event1.php"> <form id="select_form" required method="post" action="includes/insert_event.php">
<table align="center"> <table align="center">
<tr> <tr>
<td> <td>

View File

@ -18,18 +18,18 @@ if( $_SESSION['access'] != 1 ) {
<script src="includes/js/dtp/jquery.datetimepicker.js"></script> <script src="includes/js/dtp/jquery.datetimepicker.js"></script>
<title>Edit BMS Event</title> <title>Edit BMS Event</title>
<script> <script>
$(function() { $(document).ready(function() {
$('#start_date_time').datetimepicker(); $('#start_date_time').datetimepicker();
$('#end_date_time').datetimepicker(); $('#end_date_time').datetimepicker();
});
$('#select_form').submit(function(event) { $('#select_form').submit(function(event) {
alert('test');
if ($.trim($("#is_ongoing").val()) === "" && $.trim($("#end_date_time").val()) === "") { if (!$("#is_ongoing").prop("checked") && $("#end_date_time").val() === "") {
alert('You must enter a value for Currently Ongoing or End Date and Time'); alert('You must enter a value for Currently Ongoing or End Date and Time');
event.preventDefault(); event.preventDefault();
return false; return false;
} }
}); });
});
</script> </script>
</head> </head>
<body> <body>
@ -71,7 +71,7 @@ if( $_SESSION['access'] != 1 ) {
} }
include "includes/classes/select2.class.php"; ?> include "includes/classes/select2.class.php"; ?>
<br /> <br />
<form id="select_form" required method="post" action="includes/update_event1.php"> <form id="select_form" required method="post" action="includes/update_event.php">
<table align=center> <table align=center>
<tr> <tr>
<td> <td>