[英]bootstrap datePicker how to validate as required
I use it-date-datepicker as picker for calendar.我使用 it-date-datepicker 作为日历选择器。 It's a boostrap-datepicker version based on ab-datepicker.这是一个基于 ab-datepicker 的 boostrap-datepicker 版本。 The problem is that I want that this field to be mandatory.问题是我希望这个字段是强制性的。 To do that I donwloaded jquery.validate.js too, but i can't figure out how to make it work.为此,我也下载了 jquery.validate.js,但我不知道如何使它工作。 I didn't find nothing about date validation.我没有发现任何有关日期验证的信息。
Any suggestion ?有什么建议吗?
Thanks in advance for your help在此先感谢您的帮助
this is my html code:这是我的 html 代码:
<form class="needs-validation" novalidate action="mysqlStuff.php" method="POST">
<div class="col-md-3 mb-3 " >
<!-- Default unchecked -->
<div class="custom-control custom-radio myDivTop"style="padding-left: 5px" >
<input type="radio" class="custom-control-input" id="male" name="gender" checked>
<label class="custom-control-label" for="male">Male</label>
</div>
<!-- Default checked -->
<div class="custom-control custom-radio myDivBottom" style="padding-left: 5px">
<input type="radio" class="custom-control-input" id="female" name="gender" >
<label class="custom-control-label" for="female">Female</label>
</div>
<input class="form-control it-date-datepicker " id="date" type="text" name= "birthdate" placeholder="gg/mm/aaaa" required>
</div>
<button class="btn btn-primary" id="invia" type="submit">Submit form</button>
</form>
the poor javascript code is:糟糕的 javascript 代码是:
<script>
$(document).ready(function() {
$('.it-date-datepicker').datepicker({
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.