启动日期时间选择器3多实例格式不工作
boostrap date time picker 3 multiple instance format not working
我有多个bootstrap日期时间选择器3的实例。我需要为每个输入到mysql数据库插入链接字段。我只能将其中一个实例更改为正确的格式。这就是我所处的位置。
<div class="input-append date form_datetime" data-date="2012-12-21T15:25:00Z">
Date 1
<input size="16" type="text" value="" readonly>
<br>
<span class="add-on"><i class="icon-remove"></i></span>
<span class="add-on"><i class="icon-th"></i></span>
</div>
Link1
<input type="text" id="mirror_field1" value="" readonly />
<br>
Date 2
<div class="input-append date form_datetime" data-date="2012-12-21T15:25:00Z">
<input size="16" type="text" value="" readonly>
<br>
Link2
<span class="add-on"><i class="icon-remove"></i></span>
<span class="add-on"><i class="icon-th"></i></span>
</div>
<input type="text" id="mirror_field2" value="" readonly />
<script type="text/javascript">
$(".form_datetime").datetimepicker({
format: "dd MM yyyy - hh:ii",
linkField: "mirror_field1",
linkFormat: "yyyy-mm-dd hh:ii",
linkField: "mirror_field2",
linkFormat: "yyyy-mm-dd hh:ii"
});
</script>
我用不同的id创建多个日期拾取器
$( "#datepickerA" ).datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
maxDate: "+0D"
});
$( "#datepickerB" ).datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
maxDate: "+0D"
});
$( "#datepickerC" ).datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
maxDate: "+0D"
});
然后将它们分别添加到我的输入字段
<input name="date1" type="text" id="datepickerA" placeholder="date1"/>
<input name="date2" type="text" id="datepickerB" placeholder="date2"/>
<input name="date3" type="text" id="datepickerC" placeholder="date3"/>
这个成功了。不确定为什么之前没有正确格式化输出,但不需要添加链接字段。它将其作为默认设置。只需创建一个单独的表单和输入id。
<div class="container">
<form id="form1" action="" class="form-horizontal" role="form">
<fieldset>
<legend>Test</legend>
<div class="form-group">
<label for="dtp_input1" class="col-md-2 control-label">DateTime Picking</label>
<div class="input-group date form_datetime col-md-4" data-date="1979-09-16T05:25:07Z" data-date-format="DD - MM dd, 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="text" id="dtp_input1" value="" /><br/>
</div>
<div class="form-group"><br/>
</div>
</fieldset>
</form>
</div>
<div class="container">
<form id="form2" action="" class="form-horizontal" role="form">
<fieldset>
<legend>Test</legend>
<div class="form-group">
<label for="dtp_input2" class="col-md-2 control-label">DateTime Picking</label>
<div class="input-group date form_datetime col-md-4" data-date="1979-09-16T05:25:07Z" data-date-format="DD - MM dd, yyyy - HH:ii p" data-link-field="dtp_input2">
<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="text" id="dtp_input2" value="" /><br/>
</div>
<div class="form-group"><br/>
</div>
</fieldset>
</form>
</div>
<script type="text/javascript">
$('.form_datetime').datetimepicker({
language: 'en',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1,
minuteStep: 1,
todayHighlight: true,
startDate: new Date()
});
</script>
相关文章:
- ES6构造函数返回基类的实例
- 如何使用javascript或html下载PDF格式的填写表单
- 货币代码为欧元-金额的格式不应包含小数
- Json数据包含日期和时间格式
- Javascript日期格式类似于ISO,但本地
- KnockoutJS-组件-多个实例
- 为什么无法在TypeScript中导出类实例
- 如何在GoogleWeb工具包(GWT)中从JSNI调用接口(实例化)
- fluxxor向一个flux实例添加一组以上的操作
- 更改angularjs中的日期-时间格式
- 将日期时间从json转换为可读格式
- NodeJS日期格式不起作用
- 使用jQuery获取Dropzone实例/对象
- 我能得到正确的格式吗
- PHP:显示sqlite数据库中的html格式数据,使用tinymce保存
- 使用正则表达式将输入格式设置为单字符逗号、单字符逗号等
- "实例范围”;TypeScript类的getter/setter
- 将日期和时间转换为UTC格式的日期-Javascript
- 日期为dd/mm/YYYY格式的实例日期
- 启动日期时间选择器3多实例格式不工作