Pages

Showing posts with label Localized Calendar Date Picker using. Show all posts
Showing posts with label Localized Calendar Date Picker using. Show all posts

Thursday, 12 April 2012


    Localized Calendar Date Picker using <liferay:ui>


Following is the simple but very useful script to display localized calendar date picker-


Calendar defaultValueDate = CalendarFactoryUtil.getCalendar(timeZone, locale);

<liferay-ui:input-date     dayValue=”<%= defaultValueDate.get(Calendar.DATE) %>”

                        dayParam=”day”

                        disabled=”<%= false %>”

                        firstDayOfWeek=”<%= defaultValueDate.getFirstDayOfWeek() – 1 %>”

                        monthParam=”month”

                        monthValue=”<%= defaultValueDate.get(Calendar.MONTH) %>”

                        yearParam=”year”

                        yearValue=”<%= defaultValueDate.get(Calendar.YEAR) %>”

                        yearRangeStart=”<%= defaultValueDate.get(Calendar.YEAR) %>”

                        yearRangeEnd=”<%= defaultValueDate.get(Calendar.YEAR) + 50 %>”

/>


To get the parameters in java code you can simply use –

actionRequest.getParameter(“day”) for day
actionRequest.getParameter(“month”) for month
actionRequest.getParameter(“year”) for year

Regards,
Srikanth