我有以下的看法:
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css" />
<form class="form-horizontal" role="form" method="POST" action="{{ route('admin.create_athlete') }}">
{{ csrf_field() }}
<div class="form-group">
<div class="col-md-6">
<div class="input-group date" data-provide="datepicker" data-date="2001/01/01">
<input type="text" readonly="" class="form-control">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- Datepicker -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js"></script>
<script type="text/javascript">
$.fn.datepicker.defaults.format = "yyyy/mm/dd";
$('#datepicker').datepicker()
.on('changeDate', function (ev) {
$('.datepicker').hide();
});
var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
$.fn.bootstrapDP = datepicker;
</script>
在我的控制器中,我返回了查看数据的请求:
public function store(Request $request)
{
return $request->all();
}
甚至没有列出日期字段:{"_token":"3Klr9x8iNW8GUDtCyX4mZFly3U1WPVIZB63Jwev1","name":"f","surname":"f","gender":"male","cellphone":"5","email":"","idnumber":""}
为什么日期值不随post命令一起提交?
发布于 2016-09-16 04:54:57
试着改变这一点:
<input type="text" readonly="" class="form-control">
要这样做:
<input name="date" type="text" readonly="" class="form-control">
看看它是不是有效。
控制器通过"name“属性查找字段。如果您没有在输入中输入"name“字段,那么post方法将不会考虑它。
https://stackoverflow.com/questions/39520126
复制相似问题