表单提交后,Datepicker OnClose()无法正常工作

时间:2015-06-15 08:09:36

标签: javascript jquery html5 datepicker thymeleaf

下面的代码对我来说很好。 (OnClose of ValidFrom datepicker,它应该为ValidTo设置minDate,反之亦然)

$( "#validFrom" ).datepicker({ 
      dateFormat : 'dd-M-yy', 
      changeMonth: true,
      changeYear: true,                                   
      onClose: function( selectedDate ) { 
        $( "#validTo" ).datepicker( "option", "minDate", selectedDate );
      }
    }); 
$( "#validTo" ).datepicker({ 
      dateFormat : 'dd-M-yy',
      changeMonth: true,
      changeYear: true,
      onClose: function( selectedDate ) { 
        $( "#validFrom" ).datepicker( "option", "maxDate", selectedDate );

      }
    });

但是在表单提交后,功能无效。它没有将mindate和maxDate设置为指定的

添加正在使用的css和js:

<script th:src="@{/js/jsDatePick.min.1.3.js}"></script> <link th:href="@{/css/jquery.ui.datepicker.css}" rel=" stylesheet" />

Javascript调用提交:

searchActionURL = function(obj) {

var atleastOneFilled = checkFields($("#searchForm")); 
$('#searchValidate').val(atleastOneFilled); 
$("#searchForm").attr("action", obj);    
if(atleastOneFilled)
{
    $("#searchResults").show(); 
}
else
{
    alert('Please specify one search item');
    return false;   
}
};

0 个答案:

没有答案