Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 461 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Validation, How to validate entered date with current date

#1
So I would like my date picker to be validated, giving the user a error script if they pick a day that exceeds the current day. In other words, they must only be able to enter a date that has not yet occured. This is my script:

<script type="text/javascript">
function checkForm(form)
{
var from_hour = document.getElementById('from_hour').value;
var from_minute = document.getElementById('from_minute').value;
var to_hour = document.getElementById('to_hour').value;
var to_minute = document.getElementById('to_minute').value;
if (from_hour > to_hour) {
alert('"From: H:"field cannot be larger than "To: H:" field');
return false;
} else if (from_hour === to_hour) {
if (from_minute > to_minute) {
alert('"From: M:"field cannot be larger than "To: M:" field');
return false;
}


}


}

</script>
<legend>Time Log</legend>
<form name="form" method="post" action="" onsubmit="return checkForm(this)" >
<table>

<tr>
<td>Date:</td>
<td><input type="text" required name="date" id="date" /></td>
<script>
$('#date').datepicker({dateFormat: "dd/mm/yy"});</script>


</td> </tr>
Reply

#2
If you want to disable past date as well as current date you can use following statement-


$('#date').datepicker({minDate:1,dateFormat: "dd/mm/yy"});

Above statement will allow user to choose future date only
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through