Fórumok
Liferay DatePicker and OnChange
Mike Harris, módosítva 12 év-val korábban
Liferay DatePicker and OnChange
Junior Member Bejegyzések: 91 Csatlakozás dátuma: 2011.03.28. Legújabb bejegyzések
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?
<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, módosítva 12 év-val korábban
RE: Liferay DatePicker and OnChange
Junior Member Bejegyzések: 91 Csatlakozás dátuma: 2011.03.28. Legújabb bejegyzések
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!