1
I have in my form the date field that forces the user to only numbers and if other options are not selected he returns an Alert. But my doubt relates to the field date already quoted. As I force the user to enter the 8 numbers of the date, and if you do not type, when giving Submit, it will return some error as an Alert?
Follow what I have ready until agr:
function formatar(mascara, documento){
var i = documento.value.length;
var saida = mascara.substring(0,1);
var texto = mascara.substring(i);
if (event.keyCode < 48 || event.keyCode > 57) {
event.returnValue = false;
}
if (texto.substring(0,1) != saida){
documento.value += texto.substring(0,1);
}
}
<form class="got" method="GET" action="Dia_rtd.php" name="troca" onsubmit="return verifica()">
<input type="text" maxlength="10" placeholder="Data" name="Data_dd" OnKeyPress="formatar('##/##/####', this)" style="width:70px;"/>
<button class="css_btn_class" type="submit">Atualizar</button>
</form>