这个大概是事件冒泡造成的.
解决办法:
<form id="userForm" class="form-horizontal">
<input type="hidden" name="id" id="id" />
<div class="modal-header">
<button type="button" class="close" onclick="base.winClose()">×</button>
<h4 class="modal-title" id="myModalLabel">添加用户</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label">用户名:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="userName" name="userName" placeholder="请输入名称" /> </div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">请选择</label>
<div class="col-sm-6">
<div class="radio">
<label>
<input type="radio" name="sex" value="0" checked> 男
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="sex" value="1"> 女
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for=test>选择列表</label>
<div class="col-sm-6">
<select id="test" name="test" class="form-control">
<option value="">请选择</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="password">密码:</label>
<div class="col-sm-6">
<input class="form-control" id="password" name="password" type="password" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="confirm_password">确认密码:</label>
<div class="col-sm-6">
<input class="form-control" id="confirm_password" name="confirm_password" type="password" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="email">E-Mail:</label>
<div class="col-sm-6">
<input class="form-control" id="email" name="email" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="phone">手机号码:</label>
<div class="col-sm-6">
<input class="form-control" id="phone" name="phone" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="birthday">生日:</label>
<div class="col-sm-6">
<input class="form-control" id="birthday" name="birthday" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">最小和最大文件的大小</label>
<div class="col-sm-6">
<input type="file" class="form-control" name="fourthFile" />
<span class="help-block">选择一个pdf文件大小1米和10米之间.</span>
</div>
</div>
<div class="form-group">
<label for="dtp_input1" class="col-md-2 control-label">时间</label>
<div class="input-group date form_datetime col-md-5" data-date-format="dd MM yyyy - HH:ii p" data-link-field="dtp_input1">
<input class="form-control" size="16" type="text" value="" readonly>
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
</div>
<input type="hidden" id="dtp_input1" value="" />
<script type="text/javascript">
base.get('.form_datetime').datetimepicker({
language: 'zh',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 1,
showMeridian: 1,
pickerPosition:'top-right'
}).on('hide', function(event) {
100 event.preventDefault();
101 event.stopPropagation();
102 });
</script>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" onclick="base.winClose()">关闭</button>
<button type="button" class="btn btn-primary" onclick="base.addUser()">提交更改</button>
</div>
</form>
主要就是图中红色部分: 99--> 102行
base.get('.form_datetime').datetimepicker({
language: 'zh',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 1,
showMeridian: 1,
pickerPosition:'top-right'
}).on('hide', function(event) {
event.preventDefault();
event.stopPropagation();
});
参考链接:
https://github.com/uxsolutions/bootstrap-datepicker/issues/50