Validation removed time : ps

This commit is contained in:
VE10-Sanjeev 2023-12-02 18:35:39 +05:30
parent 9a9bd8536c
commit 6bd45d798b

View File

@ -12,7 +12,7 @@
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="group_id" class="col-form-label">Group<span class="text-danger"></span></label>
<label for="group_id" class="col-form-label">Group<span class="text-danger"> *</span></label>
<!-- <select id="group_id" name="group_id[]" class="form-control select2-multiple" data-toggle="select2" multiple="multiple" data-placeholder="Choose ..." required> -->
<select id="group_id" name="group_id[]" class="form-control" multiple="multiple" required>
<option value="">Choose the Group</option>
@ -49,7 +49,7 @@
</div>
</div>
<div class="form-group col-md-12">
<label for="load_templateid" class="col-form-label">Template<span class="text-danger"></span></label>
<label for="load_templateid" class="col-form-label">Template<span class="text-danger"> *</span></label>
<select id="load_templateid" name="template_id" class="form-control" required>
<option value="">Choose the Template</option>
<!-- <?php foreach ($template_details as $value) { ?>
@ -156,33 +156,9 @@
// Get the current date and time
const now = new Date();
const currentDate = now.toISOString().split('T')[0]; // Get current date in YYYY-MM-DD format
const currentTime = now.toTimeString().split(' ')[0]; // Get current time in HH:MM:SS format
const dateInput = document.getElementById('example-date');
const timeInput = document.getElementById('example-time');
dateInput.setAttribute('min', currentDate);
timeInput.setAttribute('min', currentTime);
timeInput.addEventListener('input', function() {
if (dateInput.value === currentDate) {
const selectedTime = timeInput.value;
if (selectedTime < currentTime) {
timeInput.value = currentTime;
}
}
});
// Optional: Disable past dates in date input if needed
dateInput.addEventListener('input', function() {
if (dateInput.value === currentDate) {
const selectedTime = timeInput.value;
if (selectedTime < currentTime) {
timeInput.value = currentTime;
}
}
});
</script>