1
I have a form with two date inputs. One receives the start of the event, and the other the end of the event. With that in mind, I’m trying to create a Javascript function that makes it impossible for the end date to be before the start date. How can I do that?
I’ve already looked at some answers in Stack Overflow in English, but they haven’t solved the problem. My form is this:
<form name="form" action="novoevento" method="post" onsubmit="return autenticarDados()" class="form-inline">
<div class="form-group">
<label for="name">Nome do Evento:</label>
<input required="required" type="text" class="form-control" name="nome">
</div>
<div class="form-group">
<label for="dataInicio">Data de começo do evento:</label>
<input required="required" type="date" min="2017-12-01" max="2017-12-31" class="form-control" name="dataIni">
</div>
<div class="form-group">
<label for="dataFim">Data de fim do evento:</label>
<input required="required" type="date" min="2017-12-01" max="2017-12-31" class="form-control" name="dataFim">
</div>
<button type="submit" name="Registrar" class="btn btn-default">Submit</button>
</form>
@When I take the test, it gives a valid date! , an event can start and end on the same day, unless in its logic it has to be at least 1 day, so the verification could be valid only if
fim > inicio
.– Laércio Lopes
All right, I misread rs.. was wrong. + 1
– Sam
Tranquilo, Valeu @Dvd!
– Laércio Lopes