我通过emailmeform处理表单,我想禁止选择今天之前的日期。 如何限制像this one这样的日期选择器的日期(三个单独的文本框)?
我尝试添加一个包含" .datepicker({minDate:0})"的脚本区域。在我的表格的标题中,但是日,月和年的字段分离使操作变得复杂!
EMF_jQuery('.datepicker').datepicker({
yearRange: '-120:+20',
showOn: 'button',
buttonImage: base_url+'images/calendar.png',
buttonImageOnly: true,
onSelect: function(dateText, inst) {
var selectedDate = new Date(dateText);
EMF_jQuery('#'+inst.id+'year').val(selectedDate.getFullYear());
EMF_jQuery('#'+inst.id+'year-mm').val(((selectedDate.getMonth()+1)>9)?(selectedDate.getMonth()+1):('0'+(selectedDate.getMonth()+1)));
EMF_jQuery('#'+inst.id+'year-dd').val(selectedDate.getDate()>9?selectedDate.getDate():'0'+selectedDate.getDate());
EMF_jQuery('.'+inst.id+'yearformError').remove();
EMF_jQuery('.'+inst.id+'year-mmformError').remove();
EMF_jQuery('.'+inst.id+'year-ddformError').remove();
EMF_jQuery('#'+inst.id+'year'+','+'#'+inst.id+'year-mm'+','+'#'+inst.id+'year-dd').change();
},
changeMonth: true,
changeYear: true
});
HTML
<div class="emf-div-field"><span class="emf-field-datetime-day">
<input maxlength="2" id="element_21_year-dd" name="element_21_day" value="" class="emf-input-w20 validate[optional,custom[onlyNumber],length[2,2],lengthValue[1,31]]" type="text" size="2" temp_disabled="0" temp_validation_def="validate[optional,custom[onlyNumber],length[2,2],lengthValue[1,31]]">
<label for="element_21_year-dd" class="emf-bottom-label">JJ</label>
</span><span class="emf-sep">/</span><span class="emf-field-datetime-month">
<input maxlength="2" id="element_21_year-mm" name="element_21_month" value="" class="emf-input-w20 validate[optional,custom[onlyNumber],length[2,2],lengthValue[1,12]]" type="text" size="2" temp_disabled="0" temp_validation_def="validate[optional,custom[onlyNumber],length[2,2],lengthValue[1,12]]">
<label for="element_21_year-mm" class="emf-bottom-label">MM</label>
</span><span class="emf-sep">/</span><span class="emf-field-datetime-year">
<input maxlength="4" id="element_21_year" name="element_21_year" value="" class="emf-input-w40 validate[optional,custom[onlyNumber],length[4,4]]" type="text" size="4" temp_disabled="0" temp_validation_def="validate[optional,custom[onlyNumber],length[4,4]]">
<label for="element_21_year" class="emf-bottom-label">AAAA</label>
</span><span>
<input type="hidden" id="element_21_" class="datepicker hasDatepicker" my_date_format="mm/dd/yy" value="02/15/2017" temp_disabled="0"><img class="ui-datepicker-trigger" src="//assets.emailmeform.com/images/calendar.png" alt="..." title="...">
</span></div>
你有解决方案吗? 提前致谢