Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Owen James
aui:input for Date field and custom css
October 11, 2011 9:57 AM
Answer

Owen James

Rank: New Member

Posts: 3

Join Date: September 27, 2011

Recent Posts

Hi !

Here comes a new question and i hope people around could help me again.

I have a model with a Date field and a form. I used the aui:input to display the Date field by copying what i saw on the details.jsp (where the date of birth of a user is displayed). But, unlike to details.jsp, my aui:input display date and time and i don't want time to be displayed. I've try a lot of combinaison, including formatting the date so that the time will not be set, but still...

I've read and re read details.jsp and didn't understand why their aui:input didn't display time.

I've another question related to aui:input for Date field.

For an excerpt of code, i have

<aui:input name="birthday" value="<%= dteOfBirth%>" label=""/> where dteOfBirth is set to new Date(). My context model have a set/getBirthDay getter/setter.

What can i do if i want the generated "Select" fields to be aligned in a certain way ? Particularly, i want to reduce length for the day part, adjust length for the month part so that all the generated components will hold on one line.

Thanks in advance.
MICHAIL MOUDATSOS
RE: aui:input for Date field and custom css
October 12, 2011 12:52 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

Owen James:

I have a model with a Date field and a form. I used the aui:input to display the Date field by copying what i saw on the details.jsp (where the date of birth of a user is displayed). But, unlike to details.jsp, my aui:input display date and time and i don't want time to be displayed. I've try a lot of combinaison, including formatting the date so that the time will not be set, but still...


The value of the input field, is it connected to a String property? If not, try it and in getter just fetch the toString value out of your Date object and then, get the desired substring. In setter try to create a Date object out of the given string. You can add input validation code/tags to ensure valid input.



Owen James:

What can i do if i want the generated "Select" fields to be aligned in a certain way ? Particularly, i want to reduce length for the day part, adjust length for the month part so that all the generated components will hold on one line.


I would go and tamper with css properties for presentational-wise things. You can define specific classes for which you would set the css properties in aui tags (I think there's a styleClass parameter to set to the name of the CSS class whose properties will apply to the aui tag)