从模态中单击更新按钮后出现此错误。 https://www.screencast.com/t/NOJr22Jyip 我提交的其他数据都可以,只有这个日期选择器有问题。
<div class="row">
<div class="col-xl-12">
<div class="form-row">
<div class="col-md-4 mb-3">
<div class="form-group bmd-form-group is-focused">
<label class="bmd-label-floating" for="birthday">Birthday</label>
<input type="text" class="form-control Dtpicker" id="birthday" name="birthday" value="{{employee.birthday}}" >
</div>
</div>
</div>
</div>
</div>
Views.py
def save_employee_update(request):
bday = request.POST['birthday']
employee = Employee.objects.get(employee_id=emp_id)
employee.birthday = bday
employee.save()
# return render(request, 'index.html', {'form': form, 'successful_submit': True})
return render(request, 'index.html')
JS。
$(".Dtpicker").datetimepicker({
format: "YYYY-MM-DD",
useCurrent: false,
icons:
{
next: 'fa fa-angle-right',
previous: 'fa fa-angle-left'
}
})
$(document).on("click", "#employee_update_btn", function () {
if ($('#birthday').val() == ''){
return
}
});
单击更新按钮后,将显示警报,但是当我尝试打印生日值时,它不包含任何内容。并显示该错误。