over here I have a date picker that I'm using for creating a departure date and selecting a city on where to go to.
"app.blade.php"
<script>
$(document).ready(function(){
var date_input=$('input[name="departure_date"]'); //our date input has the name "date"
var container=$('.bootstrap-iso form').length>Date.now() ? $('.bootstrap-iso form').parent() : "body";
var options={
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
minDate: Date.now()
};
date_input.datepicker(options);
})
And the "create.blade.php"
<form method="post" action="">
<div class="form-group"> <!-- Date input -->
<label class="control-label" for="departure_date">Date
<input class="form-control" id="departure_date" name="departure_date" placeholder="DD/MM/YYYY" type="text"/>
</label>
</div>
<div class="form-group">
<label class="control-label" for="location">Location
<br>
<select class="form-control" name="location" id="LocationUsers">
<option value="empty" selected>Empty</option>
@foreach($LocationUsers as $LocationUser)
<option value="" class="form-control">
-</option>
@endforeach
</select>
</label>
</div>
<br>
<input type="submit" class="btn btn-primary" value="Create departure">
</form>
The problem is, I can't seem to add the method that the minimum date has to be today and that it can't select dates from the past. Any idea how to get this working?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire