How could you develop routine [code block], in order to treat the text field where you have to insert the Hours in real time (current time, arising from the moment). If the user tries to add hours past - issue warning that can not enter daylight hours .
For example:
If they are 7:00 in the morning, the user can put 7:00, 7:01 or 7:02 or more >, but never enter less .
This prevents malicious and / or unsuspecting user (s) from attempting to circumvent the system - then it will sound a:
alert('Horário inaceitável. Você atrasou seu danadinho! Insira a HORA atual. Quando chegar o dia do pagamento a gente conversar.rsrs')
Code
function Mascara_Hora(Hora){
var hora01 = '';
hora01 = hora01 + Hora;
if (hora01.length == 2){
hora01 = hora01 + ':';
document.forms[0].Hora.value = hora01;
}
if (hora01.length == 5){
Verifica_Hora();
}
}
function Verifica_Hora(){
hrs = (document.forms[0].Hora.value.substring(0,2));
min = (document.forms[0].Hora.value.substring(3,5));
estado = "";
if ((hrs < 00 ) || (hrs > 23) || ( min < 00) ||( min > 59)){
estado = "errada";
}
if (document.forms[0].Hora.value == "") {
estado = "errada";
}
if (estado == "errada") {
alert("Hora inválida!");
document.forms[0].Hora.focus();
}
}
<input name="Hora" type="text" id="Hora" class="input_text" OnKeyUp="Mascara_Hora(this.value)" size="5" maxlength="5">
However, it is almost ready to accept this logic [accept current time to validate], which I do not know yet.