Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to add calendar for a form input field?
Hi,
How do I add calendar for a form input field in struts portlet. I am using Crystalx-theme, is there a tld file and javascript file for calendar that can be just used to add Calendar option for a form input field?
Also where do i edit if i want the format of the date to be in yyyy-mm-dd? Also instead of drop down for the months and the year range I need just a plain text field with calendar option which would take dates in yyyy-mm-dd format.
How do I add calendar for a form input field in struts portlet. I am using Crystalx-theme, is there a tld file and javascript file for calendar that can be just used to add Calendar option for a form input field?
Also where do i edit if i want the format of the date to be in yyyy-mm-dd? Also instead of drop down for the months and the year range I need just a plain text field with calendar option which would take dates in yyyy-mm-dd format.
Hi!:
You can add it using this:
You can do some research in its related files: InputFieldTag.java, liferay-ui.tld and page.jsp
Greetings
Juan Fernández
You can add it using this:
<liferay-ui:input-field model="<%= CalEvent.class %>" field="startDate" />You can do some research in its related files: InputFieldTag.java, liferay-ui.tld and page.jsp
Greetings
Juan Fernández
Hi guys,
I can't populate the form backing bean with the Date value from these Date input fields. The field of bean that corresponds to the form field is of type Date, so that for example:
taglib finds out the field has type "Date" so that it renders the Date widget with calendar, but the form backing bean never gets populated after submit. As well as here :
How can I populate a form backing object (declared in aui:model-context) with Date value from these calendars ?
Also I can't figure out what is the proper use of this one:
It's just a widget that puts its values into request like this:
to render into particular time setting, but I can't see anything else I can do with it :-)
I can't populate the form backing bean with the Date value from these Date input fields. The field of bean that corresponds to the form field is of type Date, so that for example:
<aui:input label="Time Frame" name="timeFrame" />taglib finds out the field has type "Date" so that it renders the Date widget with calendar, but the form backing bean never gets populated after submit. As well as here :
<liferay-ui:input-field model="<%= CalEvent.class %>" field="timeFrame" />How can I populate a form backing object (declared in aui:model-context) with Date value from these calendars ?
Also I can't figure out what is the proper use of this one:
<liferay-ui:input-date yearrangeend="" yearrangestart="" formname=""></liferay-ui:input-date>It's just a widget that puts its values into request like this:
{ liferay-ui:input-date:dayValue, value }to render into particular time setting, but I can't see anything else I can do with it :-)
I suppose that the only way how to get DATE type of data out of forms is this one:
Cause all the other tags looks like they could do it, but as I was looking into the source code ... this seems as the only way...
int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth");
int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay");
int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear");
<aui:input name="birthdayMonth" type="hidden" value="<%= Calendar.JANUARY %>" />
<aui:input name="birthdayDay" type="hidden" value="1" />
<aui:input name="birthdayYear" type="hidden" value="1970" />
Cause all the other tags looks like they could do it, but as I was looking into the source code ... this seems as the only way...
Sorry for my confusion, I was using aui:input tag without trying liferay-ui:input-date/time first...now it's everything clear to me
Jakub Liska:
Sorry for my confusion, I was using aui:input tag without trying liferay-ui:input-date/time first...now it's everything clear to me
Hi Jakub,
Could u plz share ur learnings.
Hi Tanweer,
well if you use aui:input, then the tag library recognizes (based on model-hints) what data type the field is of - Date. So that it uses liferay-ui:input-date/time under the hood. With these two tags it is obvious, you declare params of year, month, day etc., and you know what parameters in request holds the particular values of year, month, day etc. as integer values. But as I was using aui:input tag for this I thought that it populates field (Date) of bean/command object with Date value...
Take a look at this thread
Instead of getting the individual integer values, which is stupid (as the only possibility), it would be much better if it returned MDY string and programmer could use variety of classes for converting it into Date type. With Spring MVC, you wouldn't have to write anything except of one line registering editor that does this conversion.
well if you use aui:input, then the tag library recognizes (based on model-hints) what data type the field is of - Date. So that it uses liferay-ui:input-date/time under the hood. With these two tags it is obvious, you declare params of year, month, day etc., and you know what parameters in request holds the particular values of year, month, day etc. as integer values. But as I was using aui:input tag for this I thought that it populates field (Date) of bean/command object with Date value...
Take a look at this thread
Instead of getting the individual integer values, which is stupid (as the only possibility), it would be much better if it returned MDY string and programmer could use variety of classes for converting it into Date type. With Spring MVC, you wouldn't have to write anything except of one line registering editor that does this conversion.
Thnx Jakub, for your knowledge sharing.A gr8 learning....
Jakub Liska:
Hi Tanweer,
well if you use aui:input, then the tag library recognizes (based on model-hints) what data type the field is of - Date. So that it uses liferay-ui:input-date/time under the hood. With these two tags it is obvious, you declare params of year, month, day etc., and you know what parameters in request holds the particular values of year, month, day etc. as integer values. But as I was using aui:input tag for this I thought that it populates field (Date) of bean/command object with Date value...
Take a look at this thread
Instead of getting the individual integer values, which is stupid (as the only possibility), it would be much better if it returned MDY string and programmer could use variety of classes for converting it into Date type. With Spring MVC, you wouldn't have to write anything except of one line registering editor that does this conversion.
How can i do this? I work with liferay 6 and spring MVC, but i can´t associate a form file with the liferay-ui:input-date