留言板

Liferay DatePicker and OnChange

Mike Harris,修改在12 年前。

Liferay DatePicker and OnChange

Junior Member 帖子: 91 加入日期: 11-3-28 最近的帖子
I have a date picker like this :

<div id="endDate">
<label class="aui-field-label" for="endDateMonth"><liferay-ui:message key="contract.enddate.label" /></label>
<liferay-ui:input-date yearRangeEnd="<%=calendar.get(Calendar.YEAR) + 5 %>" yearRangeStart="2009"
dayParam="endDateDay" monthParam="endDateMonth"
yearParam="endDateYear" dayValue="<%= contract.getEndDateDay() %>"
monthValue="<%= contract.getEndDateMonth() %>"

yearValue="<%= contract.getEndDateYear() %>"
disabled="<%=contract.getId() > 0 %>"/>
</div>


I want to be able to do something on the "onChange" event, so I added a script like :

// called avec onLoad
function init() {
${namespace}ajaxGetSupplierInfo($('#${namespace}supplierId').val());
${namespace}ajaxGetSalesRepInfo($('#${namespace}salesRepId').val(), $('#${namespace}regionId').val());

$('#startDate .aui-datepicker-day, #startDate .aui-datepicker-month, #startDate .aui-datepicker-year').attr('onchange', 'alert("test");');
}


This works when I change the drop down, but when I select a date from the calendar "popup" the onchange doesn't work.

I also tried with :


$('#startDate .aui-datepicker-day, #startDate .aui-datepicker-month, #startDate .aui-datepicker-year').change(function() {
alert("change");
});


Without any luck... Any idea?
Mike Harris,修改在12 年前。

RE: Liferay DatePicker and OnChange

Junior Member 帖子: 91 加入日期: 11-3-28 最近的帖子
I got tired of trying and I used a window.interval to check the value... If you have a better solution, please let me know!