jeesite #form中WdatePicker时间控件,限制时间选择的范围,比如最多一个月
开始试着在#form里边写onclick,添加 WdatePicker({minDate: '#F{$dp.$D(\'startDate_lte\',{M:-1})}'}),结果不起作用,还导致日期控件无法选择,最后分开到js中加入click事件,可以了
html代码:
<div class="control-inline">
<#form:input path="startDate_gte" id="startDate_gte" readonly="true" maxlength="20" class="form-control Wdate-datetime"
dataFormat="datetime" />
--
<#form:input path="startDate_lte" id="startDate_lte" readonly="true" maxlength="20" class="form-control Wdate-datetime"
dataFormat="datetime" />
</div>
js代码:
$("#startDate_gte").click(function () {
WdatePicker({
name:'zh-cn',
charset:'UTF-8',
dateFmt: 'yyyy-MM-dd HH:mm',
minDate: '#F{$dp.$D(\'startDate_lte\',{M:-1})}',
maxDate: '#F{$dp.$D(\'startDate_lte\')||\'%y-%M-%d\'}',
isShowClear:false,
readOnly: true
})
})
$("#startDate_lte").click(function () {
WdatePicker({
name:'zh-cn',
charset:'UTF-8',
dateFmt: 'yyyy-MM-dd HH:mm',
minDate: '#F{$dp.$D(\'startDate_gte\')}',
maxDate: '#F{$dp.$D(\'startDate_gte\',{M:1})}',
isShowClear:false,
readOnly: true
})
})